I am using
^(?i)(?=.*\bWORD_TO_FIND\b).*$
In this specific case I am trying to match "S.A.M."
This way it works:
^(?i)(?=.*\bs.a.m\b).*$
This way it doesn't:
^(?i)(?=.*\bs.a.m.\b).*$
Why does that fullstop brakes the match?
I am using
^(?i)(?=.*\bWORD_TO_FIND\b).*$
In this specific case I am trying to match "S.A.M."
This way it works:
^(?i)(?=.*\bs.a.m\b).*$
This way it doesn't:
^(?i)(?=.*\bs.a.m.\b).*$
Why does that fullstop brakes the match?
That is because of \b
or word boundary
.After .
there is no \b
or word boundary
but after m
there is.
^(?i)(?=.*\bs\.a\.m\.\b).*$
^^
Here no word boundary so assertion or lookahead fails.
You should also be escaping
.
if you want to match .