August 21st, 2013, 10:56 AM
Regex for Clientbackup
as a part of a Java Client Backup Project I need a Regex command.
I want to exclude folders from the backup by Regex.
Excludes like that are working fine:
(?i).:/Program Files \(x86\)/.*
Now I search a Regex that excludes all folders of a drive except c:/Users/*
I tried (?i).:/!(Users)/.* but this ist not workink.
I also read a tutorial but didn't get informations about "all, but one not".
One more examble:
c:/Program Files/ >> match
c:/Program Files/folder1 >>match
c:/Users/ >> no match
c:/Users/User1 >> no match
Would be perfect if someone can help me.
August 21st, 2013, 11:08 AM
is there a reason why you need this strange "exclude anything but x" logic instead of simply telling the program to include x and nothing else?
Either way, an exclamation mark is no magical negation character. It's taken literally. The only way to exclude a certain expression would be through a negative lookahead:
But double negatives are just weird. Better use positive matches (or fix your application if it can't do that).
August 22nd, 2013, 04:03 AM
than you for your help.
The Backup solution just allows excludes with RegEx. Normaly you exclude c:/windows or c:/Temp.
Our Client strategy is that the users uses just c:/Users/xx folder. So we have to exclude all other folders. On the other site we don't want to force the user to backup the full user path. Users can choose all folders under c:/Users/____.
My final Regex are working fine: