Hey I have a list of files
- B123245.xml
- B123245-ext.xml
- 1234W01.xml
- 1234W01-ext.xml
Now I need a regular expression filter only the files without -ext in the name.
I tried already this ^.+(?!-ext)\.xml$
but it is not working.
What am I doing wrong?
Hey I have a list of files
Now I need a regular expression filter only the files without -ext in the name.
I tried already this ^.+(?!-ext)\.xml$
but it is not working.
What am I doing wrong?
 
    
    Not sure about your exact needs, but if you want to exclude those file where "-ext" is right before the xml extension I think you could use:
^.+(?<!-ext)\.xml$
See the demo
^ - Start string anchor..+ - 1+ character apart from newline.(?<!-ext) - A negative lookbehind to assert position isn't preceded by "-ext".\.xml - Match a literal dot and "xml".$ - End string anchor. 
    
    With the help of user 'The fourth bird' I found out the correct structure.
Here is the correct result
^(?!.*-ext).+\.xml$
