formatlist() unable to handle square brackets in filter

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
jaywalker32
Posts: 205
Joined: 27 May 2014 05:24

formatlist() unable to handle square brackets in filter

Post 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.

highend
Posts: 13327
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: formatlist() unable to handle square brackets in filter

Post 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
One of my scripts helped you out? Please donate via Paypal

jaywalker32
Posts: 205
Joined: 27 May 2014 05:24

Re: formatlist() unable to handle square brackets in filter

Post by jaywalker32 »

Ah, ok. Thanks. It's working now.

I had only checked the formatlist() notes.

Post Reply