#regexes — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #regexes, aggregated by home.social.
-
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 -
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
-
Any #RakuLang core hackers want to take up this challenge?
#RegularExpressions #RegExps #RegExes #RegEx https://ruby.social/@gd/110718818730295923
-
@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