I have been using the following regex to replace all punctuation in a string:
preg_replace('/[^\w\s]/', '', $tweet);
with \w being shorthand for [a-zA-Z0-9_] and \s is used to ommit spaces. I learned this wisdom here: Strip punctuation in an address field in PHP. But now, I need the regex to strip all characters except
a-z and A-Z
{ and }
So it should strip out all dots, commas, numbers etc. What is the correct regex for this?
Possibly faster variant as proposed by FakeRainBrigand in a comment, thanks: