Re:Regex character "$" doesn't mean "end-of-string"
by emporas on Wednesday March 20, 2024 @11:43PM
(#39774719)
Regexes originate from Perl, or they were popularized by Perl if i got this right. In Perl readable code is not ranked as one of it's top 100 priorities. Regexes could originate from J and situation could be even worse though!
Re:Regex character "$" doesn't mean "end-of-string"
by TristanBall on Thursday March 21, 2024 @04:31AM
(#39776038)
Regex's predate perl quite substantially. Think grep and friends if nothing else.
Certainly making the perlre library available separate to perl encouraged its widespread use, and lots of others copied or were inspired by it.
"Popularized" doesn't seem like quite the right word though, I don't disagree with the point, but if I shout "Hey everyone let's write regex's" at the office people throw stationary at me, which is not true of other popular things!
Re:Regex character "$" doesn't mean "end-of-string"
by wlonkly on Thursday March 21, 2024 @03:44PM
(#39783462)
Perl spread regexes.
Re:Regex character "$" doesn't mean "end-of-string"
by emporas on Thursday March 21, 2024 @04:53PM
(#39784265)
Super spreader event we've got ourselves into.
I took a look at Raku, which claims be a better Perl maybe, or closely related but more modern, it certainly looks nice. Although i am a big fan of typed languages, Raku piqued my interest.
Re:Regex character "$" doesn't mean "end-of-string"
by lizmat on Friday March 22, 2024 @04:51AM
(#39788639)
In Raku, if you want to go typed, you can! It's called "gradually typed".
my Int $a = 42; # ok
my Int $a = "foo"; # Type check failed in assignment to $a; expected Int but got Str ("foo")
Re:Regex character "$" doesn't mean "end-of-string"
by emporas on Friday March 22, 2024 @09:07AM
(#39790329)
Very nice, good to know. Yes i know gradual typing, Python has a form of that i think. I will check out Raku at some point, the type system will not go unnoticed. I didn't even know it had one!
I would also imagine that, if this became the norm, IDEs would quickly standardize around common notation - probably actually based on existing regex symbols and escapes - to quickly input that, similar to TeX-like notation for inputting math. So if you're inside a regex literal, you'd type, say, \A, and the editor itself would automatically replace it with the Unicode sigil for beginning-of-string.