I’m trying to match all files except those ending with .bmp.
Due to some constraints I can’t use negation (?:, !:) and references (\1, …).
I’ve made an expression and it works for most of the strings:
^\w+\.([^b].*|b|b[^m].*|bm|bm[^p].*|bmp.+)$
It matches everything that doesn’t end with .bmp – including test.txt, test.bmp.txt, etc.
But unfourtanely, it does allow test.bi.bmp.
Any idea on how to improve the regex so it would just match files not ending with .bmp?
why not:
?
http://regexr.com?31vg7
An alternative is
^.*([^p]|[^m]p|[^b]mp|[^.]bmp)$(shorter).