I want to find (with reg expression) all files+folders with odd numbers of opening and closing brackets.
That means that the following files should be found for example:
blah blah ( one two)) end.pdf
some.other ( file name ().txt
How should a regular expression look like?
The regexp should pay attention to the sequence of opening and closing brackets too.
So the file
asfdaf ( sdg sdgfsd )) sfgg ( sgsdf.dat
has the same number of opening and closing brackets but the sequence does not fit.
How to find (with reg expression) all files+folders with odd numbers of opening and closing brackets?
-
pstein
- Posts: 64
- Joined: Thu Aug 07, 2014 6:18 pm
-
void
- Developer
- Posts: 19903
- Joined: Fri Oct 16, 2009 11:31 pm
Re: How to find (with reg expression) all files+folders with odd numbers of opening and closing brackets?
Not possible with regex.
Please try the following search:
2 levels of nesting with regex:
3 levels:
Please try the following search:
REGEXCOUNT($name:,"\(")!=REGEXCOUNT($name:,"\)")2 levels of nesting with regex:
regex:\((?:[^()]*|\([^()]*\))*$3 levels:
regex:\((?:[^()]*|\([^()]*\)|\((?:[^()]*|\([^()]*\))*\))*$-
NotNull
- Posts: 5961
- Joined: Wed May 24, 2017 9:22 pm
Re: How to find (with reg expression) all files+folders with odd numbers of opening and closing brackets?
Why regex specifically? There are other solutions.