I have the following regular expression to find word in text and highlight them
Using the word surface for testing purposes.
/((?<=[\W])surface?(?![\w]))|((?<![\w])surface?(?=[\W]))/iu
It matches all occurences in the following text.
surface-CoP-20-70-0000-04-02_Pre-Run_Tool_Verification_Programming_and_surface_Tare surface_revC.pdf
But if i change the first occurence of surface to contain a upper case letter, it only matches the first occurence.
Surface-CoP-20-70-0000-04-02_Pre-Run_Tool_Verification_Programming_and_surface_Tare surface_revC.pdf
Or if i put an upper case letter in some of the other occurences it matches that.
Surface-CoP-20-70-0000-04-02_Pre-Run_Tool_Verification_Programming_and_Surface_Tare surface_revC.pdf