I need a little help with regex to match and replace
<comma|dash|fullstop|questionmark|exclamation mark|space|start-of-string>WORD<comma|dash|fullstop|space|end-of-string>
I need to find a specific WORD (case insensitive) which
preceded by a comma or dash or full stop or question mark or exclamation mark or space or the beginning of a line
followed by: a comma or dash or a full or question mark or exclamation mark or a space or end of line
test line: LOOK to me, yes, please LOOK at me, but NOT MATCH! WATCH me and, of course, MATCH, and finally MATCH
I want to REPLACE all matches with another string in PHP, so I may need to use preg_replace or something else?
source share