Reputation: 4148
I am trying to create a regex pattern that would match the following:
Updated x word word
x
= being a number, e.g. 2
I have tried the following:
(Updated\s\d\s\w\s\w)
For example, I would like: Updated 2 mins ago
, to match.
But it doesn't seem to work: http://regexr.com/3ef05
Upvotes: 1
Views: 73
Reputation: 4027
Try this :
(Updated\s\d+\s\w+\s\w+)
The +
means "one or more characters of this type", which is probably what you need here.
See it here : http://regexr.com/3ef0b
Upvotes: 1
Reputation: 40566
You need to use quantifiers to show that the digit and word groups can consist of more than one character:
(Updated\s\d+\s\w+\s\w+)
This works: http://regexr.com/3ef08
Upvotes: 1