On Sun, 20 Apr 2025 at 17:42, <tomas@tuxteam.de> wrote:
On Sun, Apr 20, 2025 at 05:58:31PM +0100, debian-user@howorth.org.uk wrote:
Err, did you notice the bit in that reference that says: "It documents regular expressions in the form available within KatePart, which is not compatible with the regular expressions of perl"? Note that PCRE stands for Perl Compatible Regular Expressions.
And note PCRE is not Perl's regexps, but just "inspired by". They
converged and diverged over their respective histories. To get an
idea of the current situation, perhaps [2] is relevant.
[...]
[2] https://en.wikipedia.org/wiki/PCRE#Differences_from_Perl
Thanks for pointing that out. I was guilty of the same misconception
when I erroneously wrote here yesterday:
According to [?] it might be [?], which at a glance looks like it uses
PCRE (ie PERL, contradicting the above statement).
But there's no contradiction. My mistake was to assume that
PCRE and PERL regex are the same codebase, but that's not correct.
So it's not surprising that they might have some differences.
Thanks for the useful wikipedia page.
If you like to disappear in rabbit holes, this [3] one is nice. If
not, still the pic at the beginning still shows impressively an
exponential runaway for Perl's re engine compared to Tcl's which
uses a Thompson algorithm. Note that this was back in 2007 and
quite possibly Perl's engine has been refined (it definitely has
been extended) since then.
Cheers
[3] https://swtch.com/~rsc/regexp/regexp1.html
On Mon, Apr 21, 2025 at 08:04:44 +0200, tomas@tuxteam.de wrote:
[...] quite possibly Perl's engine has been refined (it definitely has
been extended) since then.
It still has the issue.
hobbit:~$ time perl -e '$s = "a" x 25; $r = "a?" x 25 . "a" x 25; if ($s =~ $r) { print "yes\n"; }'
yes
real 1.354 user 1.349 sys 0.004
That's with perl 5.36.0 from Bookworm.
$ time raku -e ‘my $s = “a” x 25; my $r = “a?” x 25 ~ “a” x 25; if
($s ~= $r) { say “yes” } ‘
Raku’s regular expression grammar is much better than Perl’s. Larry
was very picky about that.
Tom Browder (HE12025-04-21):
$ time raku -e ‘my $s = “a” x 25; my $r = “a?” x 25 ~ “a” x 25; if
($s ~= $r) { say “yes” } ‘
I almost asked if Raku uses pairs of Unicode quotes instead of the symmetrical ASCII one; then I noticed the single quotes, and I know the
shell does not.
Raku’s regular expression grammar is much better than Perl’s. Larry
was very picky about that.
This is a good occasion to ask:
As a long-time Perl 5 programmer [...]
Do you know the answer to these questions? Or a place where somebody
wrote them?
Tom Browder (HE12025-04-21):
$ time raku -e ‘my $s = “a” x 25; my $r = “a?” x 25 ~ “a” x 25; if
($s ~= $r) { say “yes” } ‘
I almost asked if Raku uses pairs of Unicode quotes instead of the symmetrical ASCII one; then I noticed the single quotes, and I know the
shell does not.
Raku’s regular expression grammar is much better than Perl’s. Larry
was very picky about that.
This is a good occasion to ask:
As a long-time Perl 5 programmer, I often wonder whether learning Raku
would be worth it. Does it take a lot of time or is it close enough to
be easy? What are the benefit? Will I find a trove of package already implementing network protocols and standard algorithms, or be able to
run Perl 5 packages somehow? And so on.
Do you know the answer to these questions? Or a place where somebody
wrote them?
Tom Browder (HE12025-04-21):
$ time raku -e ‘my $s = “a” x 25; my $r = “a?” x 25 ~ “a” x 25;
if ($s ~= $r) { say “yes” } ‘
I almost asked if Raku uses pairs of Unicode quotes instead of the symmetrical ASCII one; then I noticed the single quotes, and I know
the shell does not.
Raku’s regular expression grammar is much better than Perl’s. Larry
was very picky about that.
This is a good occasion to ask:
As a long-time Perl 5 programmer, I often wonder whether learning Raku
would be worth it. Does it take a lot of time or is it close enough to
be easy? What are the benefit? Will I find a trove of package already implementing network protocols and standard algorithms, or be able to
run Perl 5 packages somehow? And so on.
Do you know the answer to these questions? Or a place where somebody
wrote them?
Regards,
Sysop: | Keyop |
---|---|
Location: | Huddersfield, West Yorkshire, UK |
Users: | 546 |
Nodes: | 16 (0 / 16) |
Uptime: | 156:08:52 |
Calls: | 10,384 |
Calls today: | 1 |
Files: | 14,056 |
Messages: | 6,416,468 |