Here is a regex that works fine in most regex implementations:
(?
This matches .js for a string which ends with .js exc
If you can look ahead but back, you could reverse the string first and then do a lookahead. Some more work will need to be done, of course.