Here is a regex that works fine in most regex implementations:
(?<!filename)\.js$
This matches .js for a string which ends with .js except for filename.js
Javascript doesn’t have regex lookbehind. Is anyone able put together an alternative regex which achieve the same result and works in javascript?
Here are some thoughts, but needs helper functions. I was hoping to achieve it just with a regex:
http://blog.stevenlevithan.com/archives/mimic-lookbehind-javascript
^(?!filename).+\.jsworks for metested against:
A proper explanation for this regex can be found at Regular expression to match string not containing a word?
Look ahead is available since version 1.5 of javascript and is supported by all major browsers
Updated to match filename2.js and 2filename.js but not filename.js
(^(?!filename\.js$).).+\.js