The space ignore option is very useful as you say for commenting on complex expressions. I use it a lot, e.g. here <https://regex101.com/r/vPoJpa/1>.
On Sat, 19 Oct 2024 at 02:43, Neil Faiman <[email protected]> wrote: > > 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 > <https://groups.google.com/d/msgid/bbedit/C97A5C90-3123-4942-9016-A034181FC7B9%40faiman.org?utm_medium=email&utm_source=footer> > . > -- Kaveh Bazargan PhD Director River Valley Technologies <http://rivervalley.io> ● Twitter <https://twitter.com/rivervalley1000> ● LinkedIn <https://www.linkedin.com/in/bazargankaveh/> ● ORCID <https://orcid.org/0000-0002-1414-9098> ● @[email protected] <https://mastodon.social/@kaveh1000> *Accelerating the Communication of Research* * <https://www.linkedin.com/posts/bazargankaveh_ismte-innovation-award-recipient-kaveh-bazargan-activity-7039348552526921728-XAEB/?utm_source=share&utm_medium=member_desktop> [image: https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/] <https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/>* -- 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/CAJ2R9pg35Q-rERuXYAa9CEeB%2BWrGujMrTzOuAnG418ZtfxOEGg%40mail.gmail.com.
