Anyone know how to use a php regex to remove text from a string that contains regex meta-characters?
For example –
Text-string before –
"Look at the shiny apple [word]" //where 'word' could be anything
Text-string after –
"look at the shiny apple"
You replace something with regex using preg_replace.
If you want to match a special character literally you have to escape the character in the regular expression using a backslash like this
\[(if you want to match a “[“).