I have the following string:
the quick brown fox abc(1)(x)
with the following regex:
(?i)(\s{1})(abc\(1\)\([x|y]\))
and the output is
abc(1)(x)
which is expected, however, I can't seem to:
- use \W \w \d \D etc to extract more than 1 space
- combine the quantifier to add more spaces.
I would like the following output:
the quick brown fox abc(1)(x)
from the primary lookup "abc(1)(x)" I would like up to 5 words on either side of the lookup. my assumption is that spaces would demarcate a word.
Edit 1:
The 5 words on either side would be unknown for future examples. the string may be:
cat with a black hat is abc(1)(x) the quick brown fox jumps over the lazy dog.
In this case, the desired output would be:
with a black hat is abc(1)(x) the quick brown fox jumps
Edit 2:
edited the expected output in the first example and added "up to" 5 words