I need a regular expression to check if a string has this pattern:
[some random characters].DDD+DDDD
it can start with random characters, but it ends with a dot . then three digits, then a plus sign followed by four digits. How can I construct the regular expression and check if a NSString has this pattern?
Thanks!
The correct regex is
^[^.]*\.[0-9]{3}\+[0-9]{4}$Both of the other answers forgot to escape certain characters.