Reputation: 9054
I'm looking for the regex pattern of three spaces followed by any sequence of numbers followed by a period and then a space. I have achieved almost this result, except that my regex doesn't allow for any number of numbers, just one number:
NSRange range = [newString rangeOfString:@" [0-9]\\. " options:NSRegularExpressionSearch];
How can I make it detect any number of numbers 0-9?
Upvotes: 0
Views: 1450
Reputation: 70732
You can use the following regular expression.
@" {3}[0-9]+\\. "
Explanation:
{3} # ' ' (3 times)
[0-9]+ # any character of: '0' to '9' (1 or more times)
\. # '.'
# ' '
Upvotes: 2
Reputation: 60224
Just add the + quantifier after the character class
@" [0-9]+\\. "
Also MJB noted that your regex, as posted, only shows two spaces at the beginning. Was there an error in your regex? Or in your description?
Upvotes: 2