In the context of a postgres query, this –
lower(regexp_replace('If...', '[^\w\s]', ''))
gives me this –
'if..' (quotes mine)
As you can see, only one of the three periods gets trimmed. Can someone tell me what I must add to my regexp to get rid of the other two or any other special characters that might be trailing in this way?
You are probably looking for the fourth, optional parameter of
regexp_replace():SELECT regexp_replace('If...', '[^\w\s]', '', 'g');g.. for "globally", i.e. replace every match in the string, not just the first.