I’ve search around on these forums, and it seems like everyone has a slight variation of my question.
I have the following string To-Wage-a-64-Bit-Coup! and I want to delete anything that’s not a letter, number, or hyphen [a-zA-Z0-9] using preg_replace(). The end result would be that the exclamation mark would be removed.
I don’t know all the characters which need to be removed, but I know what needs to stay. This is for generating a seo-friendly url. Not sure if a negative or a positive lookahead is what I need, or perhaps use something else like preg_match() to accomplish my ends.
Put a
^at the start of a[...]to negate its effect.