I am trying to use regular expressions to check user input as they type. For example if I wanted to check against the string "Hello", and the user input was "H", "He", ..., "Hello" "Hello world" etc. it would be valid but "Hi", "H e" etc. would not.
I am currently using:
if let range = s.rangeOfString("^\\s*Hello", options: .RegularExpressionSearch){ //Valid } But this does not accept "H", "He", etc. Is there a way to do this using regular expressions?