Tag: regexkitlite

How do I escape special characters in an NSString using RegexKitLite?

I’m constructing a regular expression that uses strings input by the user but the strings might contain special characters such as . \ or * and I want those to be treated as literals and not interpreted by their special meanings in the regex. I’ve tried this: NSString *word = [input stringByReplacingOccurrencesOfRegex:@”(\\P{L})” withString:@”\\$1″]; but the […]

How to check if string matches a regular expression in objective-c?

since regular exressions are not supported in Cocoa I find RegexKitLite very usefull. But all examples extract matching strings. I just want to test if a string matches a regular expression and get a Yes or No. How can I do that?