04:08
<bakkot>
https://mastodon.social/@hailey@hails.org/111105611822853351
04:08
<bakkot>

How does it work? Turns out oniguruma, the regexp engine ruby uses, supports 'calling' previously defined capture groups with the \g<...> syntax

04:08
<bakkot>
kind of love this
04:38
<rbuckton>
I brought that to committee but it didn't get stage 1
04:42
<rbuckton>
Well, it was part of the big regexp features proposal that I had to break down into smaller proposals. I haven't presented it on its own yet because it seemed like it would have a lower likelihood of success, so it hasn't been a priority
04:42
<snek>
regex should not have that feature
04:44
<rbuckton>
It's extremely valuable and let's you compose a lot of small reusable patterns. It's very good for parsing ISO-8601 dates to spec
04:44
<snek>
i mean its certainly cool
04:44
<snek>
but i think anything complex enough to warrant it should not be a regex anymore
04:45
<rbuckton>
It's also present in a lot of engines like Perl, PCRE, Boost.Regex, Oniguruma, and Glib/GRegex
04:46
<rbuckton>
https://rbuckton.github.io/regexp-features/features/subroutines.html
04:46
<rbuckton>

Here's an example of date parsing:

(?(DEFINE)
  (?<Year>\d{4}|[+-]\d{5,})
  (?<Month>0[1-9]|1[0-2])
  (?<Day>0[1-9]|2[0-9]|3[01])
)
(?<Date>(?&Year)-(?&Month)-(?&Day)|(?&Year)(?&Month)(?&Day))
04:48
<rbuckton>
(that's from Perl, apparently I have the wrong example up for Oniguruma)
04:49
<snek>
ok but like, Temporal.ZonedDateTime.from(s) exists
04:49
<rbuckton>
That's a solution to a singular problem, not the whole domain.
04:51
<rbuckton>
Consider the TypeScript.tmLanguage file used to generate syntax highlighting in many editors. We hacked our own substitution mechanism in to inject a number of reusable regular expressions into the final output file.
04:51
<rbuckton>
(as in, we have named substitutions in the source file, and generate an output .tmLanguage file with substitutions applied)
04:52
<snek>
but tree-sitter exists
04:52
<snek>
That's a solution to a singular problem, not the whole domain.
my point is not the specific thing, its that in basically every case, a more comprehensive alternative exists, because complex data generally requires complex handling
04:55
<rbuckton>
More comprehensive in some cases is like using a sledgehammer to smash an ant. Sometimes the tools are a lot bigger than what's needed, and bring in a lot of additional overhead.
04:55
<rbuckton>
Regardless, its not the most important feature on my wishlist of RegExp features, which is why its currently on the backburner.
04:56
<rbuckton>
Sometimes the best tool is the one that's at hand.
04:58
<rbuckton>
I also know I'm among the minority that really enjoys regular expressions.
04:59
<rbuckton>
Sometimes you just want to parse your HTML using a RegExp, you know? /s
05:03
<Chris de Almeida>
You can't parse HTML with RegExp.
05:09
<ljharb>
so sayeth https://stackoverflow.com/a/1732454/632724
05:57
<rbuckton>
The <center> cannot hold
05:57
<rbuckton>
it is too late
05:58
<rbuckton>
That stackoverflow post has lived rent free in my head for well over a decade.
13:10
<Michael Ficarra>
now that some of us have arrived in Japan for the meeting next week, can we get a Japan matrix room Chris de Almeida Rob Palmer?
15:41
<Rob Palmer>
Please say if you would like to be in the Japan matrix room and do not see the invite.
15:41
<Rob Palmer>
I have invited everyone who was registered, I think.
15:42
<Willian Martins>
Is this registration for the in people attending in person, correct?
15:44
<Rob Palmer>
yes - it's only in-person that required pre-registration