For example, I want to match the following:
- file1.js
- file2.src.js
- file3.bin.src.js
- file1.binbin.js
- file1.in.js
- file1.b.js
But not:
- file1.bin.js
- file2.src.bin.js
I have the following solutions so far:
^(?!.+\.bin\.js$).+\.js$
https://regex101.com/r/iR6yC9/1. The problem with this approach is.+
as well as.js$
is spelled out twice, so it feels a bit verbose and redundant.^(?:(?!\.bin\.js$).)+\.js$
https://regex101.com/r/zQ1kE0/1. The problem with the 2nd approach is that the look ahead inside the non-capturing group makes it less readable, although it does 'reuse' the.+
I feel both solutions are not ideal. I wonder if there's a good regex to solve this problem that is more readable, less redundant