Quantcast
Channel: Regex for string not ending with given suffix - Stack Overflow
Viewing all articles
Browse latest Browse all 10

Answer by Doorknob for Regex for string not ending with given suffix

$
0
0

Use the not (^) symbol:

.*[^a]$

If you put the ^ symbol at the beginning of brackets, it means "everything except the things in the brackets." $ is simply an anchor to the end.

For multiple characters, just put them all in their own character set:

.*[^a][^b]$

Viewing all articles
Browse latest Browse all 10

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>