I am working with a regex pattern and need to verify if it matches at the start of a string, after a new line, or after a white space.
Additionally, I want to ensure that the pattern also matches the end of the string, after a new line, or a white space.
How can I create this "beginning or white space" condition without repeating myself?
For example:
"Crazy Fredrick bought many very exquisite opal jewels"
If searching for s
, it should only match the last character "s" in "jewels". The "s" in "exquisite" should not be considered a match.