Page 1 of 1
formatlist() unable to handle square brackets in filter
Posted: 15 Feb 2018 20:37
by jaywalker32
The following fails:
Code: Select all
text formatlist("ba|a[f]", "f", , "a[*");
Expected: a[f]
I'm encountering this when trying to filter a list of filenames which contain square brackets.
Re: formatlist() unable to handle square brackets in filter
Posted: 15 Feb 2018 20:52
by highend
Mh?
"[" itself is a wildcard (for a range)...
So do it correctly by enclosing it in full square brackets:
Code: Select all
text formatlist("ba|a[f]", "f", , "a[[]*");
E.g. the filter command description explains this:
Code: Select all
1: Handle open square brackets, i.e. convert "[" to "[[]" to allow matching "[". Without this conversion "[" and "]" are interpreted as group markers by the pattern parser.
Moving this to questions and answers
Re: formatlist() unable to handle square brackets in filter
Posted: 15 Feb 2018 21:19
by jaywalker32
Ah, ok. Thanks. It's working now.
I had only checked the formatlist() notes.