Reputation: 11
I am looking for regex to extract following words from text. For example, the word which comes after "Replaced" in each of these lines:
Replaced disk
Replaced floppy
Replaced memory
Please suggest the regex for it.
Upvotes: 1
Views: 343
Reputation: 75252
We can't really help you without more details (like which regex flavor you're using, for example), but you probably want to match it with something like this:
Replaced\s+(\w+)\b
...and then extract the desired portion from capturing group #1.
Upvotes: 1
Reputation: 41934
I think
/Replaced\s(\w*?)/
Or:
/(?<=Replaced\s)(\w*)/
If you only want to select the word and not Replaced
.
Upvotes: 0