I have a big block of text within which I am trying to look for a phrase. The phrase can be structured in a number of different ways.
- First I want to look for a word from a set of words, let's call it set 1.
- After that there must be a space or comma (or maybe something else that separates words)
- Then there may be 0 or more words from set 2
- Again followed by the word separation characters as in point 2 above
- finally there should be a word from set 3
Ideally all of these should be in the same sentence.
set 1 = (Potential|Ability|Possibility|need|requires|needs|plenty|for|Needing|Requiring)
set 2 = (for|to|of|full|a|be|complete|Internal)
set 3 = (renovate|improve|modernise|modernize|update|renovating|improving|modernising|modernizing|updating|potential|project|renovation)
So I have this regex expression
(Potential|Ability|Possibility|need|requires|needs|plenty|for|Needing|Requiring)[ ,]*(for|to|of|full|a|be|complete|Internal)[ ,]*(renovate|improve|modernise|modernize|update|renovating|improving|modernising|modernizing|updating|potential|project|renovation)
Now this will match a phrase where there is 0 or 1 words from set 2 but not if there are multiples. e.g "provides a wonderful opportunity for someone to add their own stamp as the property needs complete renovation throughout."
as soon as I add in 'a' before 'complete' it fails. The same as if I add another 'complete'.
How do I specify to look for 0 or multiple words from a set?