home.social

#regexes — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #regexes, aggregated by home.social.

  1. 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 💪.
    entropicthoughts.com/parser-co #ParserCombinators #AdventOfCode #FutureCoding #Flexibility #HackerNews #ngated

  2. 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:

    stackoverflow.com/questions/23

  3. @regehr @commodore @dev There is even a (low-severity, a/k/a “cruel”) #PerlCritic policy to discourage everything but $_, @_, $], and numbered #RegularExpression capture variables: metacpan.org/pod/Perl::Critic:

    metacpan.org/pod/Perl::Critic: already protects you against the performance-sapping $`, $&, and $' match variables

    And you can configure your own prohibited list with metacpan.org/pod/Perl::Critic:

    #Perl #RegEx #RegExp #RegExes #RegExps

  4. @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.

    #regexes #regexps

  5. @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: perldoc.perl.org/perlretut#Emb

    We format the rest of our code for humans. Why not #regexps?

    #PerlCritic can warn against bad regexps: metacpan.org/search?size=200&q

    #regex #regexes #programming #coding #SoftwareDevelopment