| Start |
|---|
Extending String to do simple pattern matching Below is another example which builds on the above to do something useful, which can't easily be done by any other method and lends itself well to a regex solution. |
| Basic Usage There are several considerations when implementing Regular Expressions in Swift. In order to get an accurate range length that supports all character types the input string must be converted to a NSString. For safety matching against a pattern should be enclosed in a do catch block to handle failure Regular expression functionality is often put in an extension or helper to seperate concerns. |
| Replacing Substrings Patterns can be used to replace part of an input string. The example below replaces the cent symbol with the dollar symbol. |
| Special Characters To match special characters Double Backslash should be used Characters you'll have to escape include The below example get three kinds of opening brackets |
| Validation Regular expressions can be used to validate inputs by counting the number of matches. |
NSRegularExpression for mail validation or you could use String extension like this: RemarksSpecial Characters |
Read Article
https://develop.horje.com/learn/1434/reference