I'm having trouble using Regex to replace strings that have a ? in between two characters. Two examples of what I'd like Regex to match are:
• Replace thi?s question mark but not this one?
• ? Replace the lonely question mark
What's the best way to:
a) Match a character surrounded by other characters
b) Match a character that is on it's own and has no characters before it or after it
I'm using PHP preg_match and MySQL REGEXP to preform these pattern matchings. For MySQL I've tried:
SELECT description
FROM locations
WHERE description
REGEXP '/|([^?]+)\/'
For PHP I've tried:
preg_match('/|([^?]+)\/', $string);