php - Whats wrong with this regular expression? -
I have the following regular expressions for finding words and exposing them in the text
The word surface Using the test objective.
/ ((?? Lt; = [\ W]) surface? (?! [\ W])). (?????)? Surface? (? = [\ W])) / iu
This corresponds to all events in the following text.
Surface-to-20-70-0000 -04-02_Pre-Run_Tool_Verification_Programming_and_surface_Tare surface_revC.pdf
But if I surface to keep the upper case letter I first change the event, so it only matches the first event.
Surface-cum-20-70-0000-04-02_Pre-Run_Tool_Verification_Programming_and_surface_Tare surface_revC.pdf
Or if I have an upper case letter in some other incidents , Then matches it
surface-cum-20-70-0000-04-02_Pre-Run_Tool_Verification_Programming_and_Surface_Tare surface_revC.pdf
I do not know what you are trying to achieve there, but your problem is probably that \ w
will contain _
(and \ w
)).
Perhaps try this:
/ (? & Lt;! [Az]) surface (?! [Az]) / iu
or this:
/ (? & Lt; = [\ W_] surface (? = [\ W_]) / iu
Update: This information is given:
Surface-2010 should not be matched
In that case, I suspect you want:
/ (? & Lt; = \ b | _) surface (? = \ B | _) / iu
(Since just \ b
will match a match with "... and_forfest ..." so that we can add _
to include in it Option.)
Comments
Post a Comment