Page MenuHomePhabricator

Enable selecting regex "x" (IgnorePatternWhitespace) option on find-and-replace rules
Open, Needs TriagePublicFeature

Description

It would be very useful to be able to be able to format complex regex strings with whitespace for visual parsing, and have this whitespace ignored when the string is interpreted. The .NET regex flavor includes an option to ignore whitespace in the string. It would be great if this option could be enabled with a checkbox like the case sensitive, multiline, and singleline options are currently.

Event Timeline

Swpb renamed this task from Regex option to ignore newlines and tabs in search string to Enable selecting regex "x" (IgnorePatternWhitespace) option on find-and-replace rules.Feb 22 2022, 6:20 PM
Swpb updated the task description. (Show Details)

I'd prefer the find-and-replace dialogue not to get any wider than it is. Options can be turned on and off within the regular expressions themselves: the find string "\b(?x:q u i c k)\b" matches "the quick brown fox".

It doesn't necessarily have to be added to the basic "Find & Replace" tool, it could just be added to the "Replace Special" tool and the AWB Regex Tester. Anyone using patterns complex enough to want to use the x option probably isn't using the basic F&R tool for those patterns.