> On Oct 18, 2024, at 3:56 PM, Rob Russell <[email protected]> wrote: > > that's a really good explanation. > > What is the first (?x) for in your find string? I read that as searching for > an x. My limited knowledge of Grep expects (?\x ) >
There are several regular expression modes that you can set globally with (?letter) or for a specified range with (?letter :…). The x mode basically ignores white space in the regular expression, except in character sets and when escaped with a backslash. When used with the comment construct, (?# comment), they can increase the readability of a regex enormously. I wouldn’t bother when throwing together a regex for one-time use, but if I’m going to publish one … well, you be the judge. Looking at the expression in my previous post (?x) (?# 1: Leading space) [ ]* (?# 2: Fragment) … You will notice that There are a bunch of spaces that are just there for readability, and that aren’t treated as part of the text to be matched as they normally would be, and The spaces that are part of the text to be matched are written as [ ] (which makes a regex a lot more readable in any case). Cheers, Neil Faiman -- This is the BBEdit Talk public discussion group. If you have a feature request or believe that the application isn't working correctly, please email "[email protected]" rather than posting here. Follow @bbedit on Mastodon: <https://mastodon.social/@bbedit> --- You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/C97A5C90-3123-4942-9016-A034181FC7B9%40faiman.org.
