Hi guys I need a regex that only extracts punctuations/characters.
I have this so far :
[._^%$#!~@,-]+
but this works if there is at least 1 punctuations and still allows for any other char (digit or letter)
I need to to only allow punctuations/characters
Try anchoring the regex to the start and the end of the string (unless you’re using Multiline matching) – i.e.
^at the beginning and$at the end:^[._^%$#!~@,-]+$Note – this does not endorse your actual pattern (I can’t say whether this is matching all the ‘special characters’ you’re talking about, but it will make it so that the entire string must be all ‘special’.