#regexes — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #regexes, aggregated by home.social.
-
#Development #Guides
Unicode character class escapes · “A hidden JavaScript superpower.” https://ilo.im/16e85n_____
#Escapes #Unicodes #Emoji #RegExes #JavaScript #Browsers #WebDev #Frontend #Backend -
Just for the record; I looked it up:
SNOBOL by Farber, Griswold and Polonsky was developed at Bell Labs (!), 1962–1967.
Its patterns are essentially as powerful as context-free grammars, but syntactically they are rather different from regexes.
Etc.I didn't find out if there are any records of SNOBOL influencing Unix regex processing.
Obviously, that is likely, and it is also likely it has been written up. -
Raku: The match of a regex is automatically stored in $/, and this variable then also provides access to the text before ($/.prematch), to the text after ($/.postmatch), and to the match's position ($/.from and $/.to). Nice.
https://docs.raku.org/language/regexes#Literals_and_metacharacters
-
Parser combinators in #Haskell are like the cool kids at school 🎓, effortlessly solving Advent of Code problems while #regexes are stuck in detention 🚫. Who knew regexes were still a thing in 2025? 😂 In Haskell, we leave those relics to flounder in the past while we flex our combinator muscles 💪.
https://entropicthoughts.com/parser-combinators-beat-regexes #ParserCombinators #AdventOfCode #FutureCoding #Flexibility #HackerNews #ngated -
#BadApple #demo in #vim only using search queries (6,500 #regexes)
-
Never before had I considered the importance of "greedy" and "lazy" options for #regular expression matches. By default, regular expression engines try to match the maximum of a chain of characters, but for years I used #regexes not knowing the difference between "x?" and "+?". In one case the question mark says that "x" is optional, in the other, says that searching should stop as soon as a match was found. Clearly explained here and very important:
-
@neustradamus #PCRE continues to be a misnomer; it’s a modified subset of #Perl #RegularExpressions with dozens of differences: https://pcre.org/current/doc/html/pcre2compat.html
It's not "(C)ompatible." Accept no substitutes: https://perldoc.perl.org/perlre
#PCRE2 #PerlIncompatibleRegularExpressions #RegularExpression #RegExes #RegExps #regex #regexp
-
@sparkman Some people, when confronted with another person solving a problem with #RegularExpressions, think, “I know, I’ll quote @jwz.” Now they feel clever without having to contribute anything.
-
@mort You can get pretty far with #Perl 5* #RegularExpressions. Here's @perlancar’s #CPAN module based on @randalschwartz’s minimal #JSON parser as a single #regex: https://metacpan.org/pod/JSON::Decode::Regexp
Full docs on conditional #regexes, including the special `(DEFINE)` form that merlyn used: https://perldoc.perl.org/perlre#condition-yes-pattern-no-pattern
* #RakuLang hasn't been called #Perl6 for four years now. You're deadnaming the language.
-
CW: vulgar language
@vwbusguy @barubary
@Perl I’m glad https://mastodon.online/@vwbusguy/111212516938547685 works for you, but I feel pity for when you come back to it later.It’s nothing to do with #Perl and everything to do with shitty #regex possible in almost any #programming language.
Though it’s true that Perl’s reputation took a lot of damage from shitty developers filling the world with shitty #regexes in their shitty Perl code. So you’re in a big group, albeit via #Ruby.
-
Looking at some #regexes for #email, ended up going through the "bang-path" rabbit hole (user1!serv1!serv2!moreservs!someserv!user2) and other ancient stuff, finally finding: http://www.textfiles.com/humor/COMPUTER/mr.prtocl
-
@profoundlynerdy I don’t know anything about #Rakudo’s internals, but Is there any conceivable way for a language-neutral subset of #RakuLang #regexes to be based on or share its code rather than reimplement them?
The subset might omit things like code interpolation. Or is it all-or-nothing?
It would be a nice teaser for the full power of Raku grammars, kind of like how #iTunes for Windows was #SteveJobs’ offer of “a glass of water to somebody in hell.” https://a.co/5J0CTSL
-
@profoundlynerdy I don’t think other languages *have* “ripped off” #RakuLang #regexes and grammars. The point of a notional “RCRE” library would be to enable that.
-
Any #RakuLang core hackers want to take up this challenge?
#RegularExpressions #RegExps #RegExes #RegEx https://ruby.social/@gd/110718818730295923
-
@malwareminigun @jernej__s #Perl has readability affordances for #regexes that nothing else can touch: https://perldoc.perl.org/perlre#%2Fx-and-%2Fxx
-
Congratulations @siegel and @bbedit for another great feature story on the #Mac #AppStore. "Where Respect Is Due," indeed!
https://apps.apple.com/us/story/id1435835881
Here are some earlier #BBEdit stories:
• Why it's the #TextEditor of choice for #coding, #writing, #DataScience, and more: https://apps.apple.com/us/story/id1433999132
• Tips for prose #writers: https://apps.apple.com/us/story/id1451975928
• Learn and experiment with #RegularExpressions for finding and modifying text in your actual work—safely! https://apps.apple.com/us/story/id1485320067
#RegEx #RegExes -
@regehr @commodore @dev There is even a (low-severity, a/k/a “cruel”) #PerlCritic policy to discourage everything but $_, @_, $], and numbered #RegularExpression capture variables: https://metacpan.org/pod/Perl::Critic::Policy::Variables::ProhibitPunctuationVars
https://metacpan.org/pod/Perl::Critic::Policy::Variables::ProhibitMatchVars already protects you against the performance-sapping $`, $&, and $' match variables
And you can configure your own prohibited list with https://metacpan.org/pod/Perl::Critic::Policy::Variables::ProhibitEvilVariables
-
@Codely @drupler It helps to build your complicated #RegularExpressions in pieces and store them in separate variables. You can then test them in isolation and not be confused when you concatenate them together for your actual matching.
Both #PHP and #JavaScript also support named capture groups if you’re doing replacements. They’re a lot more readable.
Also, PHP’s #PCRE-based engine has a PCRE_EXTENDED flag that lets you add whitespace, newlines, and comments.
-
@Perl Are you working through the #OReilly #book ‘Learning #Perl’? Get extra practice with co-author brian d foy’s ‘Learning Perl Exercises’ #ebook: https://leanpub.com/learning_perl_exercises
Don’t have ‘Learning Perl’ yet? Buy it in paperback or ebook here: https://shop.aer.io/oreilly/p/learning-perl-8th/9781492094951-9149
Prefer #Amazon #Kindle? https://amzn.to/3QZj7t6 (affiliate link)#books #bookstodon #coding #programming #SoftwareDevelopment #ProgrammingLanguages #Perl5 #RegularExpressions #regexes #regexps #Unicode #CPAN
-
@sjn @cb 99% of the “#Perl is line noise” complaints are because of unformatted #RegularExpressions. Every language worth anything eventually supports them, but only @Perl (and #awk, earlier) makes them first-class citizens. And with Perl you can format and comment them for readability: https://perldoc.perl.org/perlretut#Embedding-comments-and-modifiers-in-a-regular-expression
We format the rest of our code for humans. Why not #regexps?
#PerlCritic can warn against bad regexps: https://metacpan.org/search?size=200&q=module%3APerl%3A%3ACritic%3A%3APolicy%3A%3ARegularExpressions
-
Remember when #programming #humor wasn’t all #memes about “durr #regexes hard,” “hurr can’t exit #vim,” and other admissions of stupidity?