Check if string contains regex

 Problem

I want to check if a string contains a specific regular expression.



 Recipe


// String literal
let s = "Hello World"

// Check if it contains one or more 'l's

if s.rangeOfString("l+", options: .RegularExpressionSearch) != nil {
    print("Yes it does")
}
				


 Playground