I have a simple regex to return all matches to files from a text file:
\\Root_Dir.*?'
They start with “\Root_dir” and end with a single quote. It works fine, but the problem is I want to exclude files with extension .rep. Based on what I read, I tried:
\\Root_Dir.*?(?!\.rep)'
This still includes files like \Root_dir\nextdir\happy.rep.
I would also like to exclude the ending single quote in what is returned if possible
I am using PowerShell 2.0, which I believe supports lookaronds.
You should use negative lookbehind..i.e you need to lookbehind of single quote for any occurance of
.rep