i've been trying to create a regex to find words that do not start with " or ' and ends with space.
This is what i have so far :
\b(?![i|"|'])test.([^\s,]+)
Test data
SHOULD WORK -> test.something test.somethingelse.another // 2 Matches This is correct
SHOULD NOT WORK -> one.test.two // 1 mathces should be 0 is not the start of word
SHOULD NOT WORK -> "test.shouldnotbeselected 'test.something //2 matches should be 0 has ' or "
NEGATIVE LOOK AHEAD WORKS WITH "i" and not with quoutes I don't know why ->
itest.doesnottake 'test.doesnottake "test.doesnottake // 2Matches should be 0
Any help would be appreciated. Thank you in advance.
You can use
(?<!\S)test\.(\S+)
See the regex demo. Details:
(?<!\S)
- a left-hand whitespace boundarytest\.
- test.
string(\S+)
- Capturing group 1: any zero or more whitespace chars, as many as possible.