Regex Cheatsheet

Dev tools

regex reference

SHOW HN2020

499points
129comments
#53of 3,028 in 2020
Top 2%of 2020 by points

How HN took it

DebatedReal support and real criticism

11 positive, 6 neutral or asking, 1 mixed, 13 critical, out of 31 comments about the project. Thread score -0.03.

Execution: 0 for, 8 againstDesign: 4 for, 0 againstDocs: 2 for, 1 againstIdea: 1 for, 1 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Railroad diagrams help understand what an expression does

    From 3 comments
    • I'm loving the graphs which for the first time in years are giving me an idea of what an expression is actually doing. Just because the visualization is kept in a form that is…
      __tk__ on HN
    • I love regex and have no trouble reading them, but still love this tool, great job. I especially like the railroad diagrams, for those cases where I brainfarted on a regex and…
      StavrosK on HN
    • This is awesome! Thank you! I hate regex, too, but I love your inline railroad diagramming tool.
      mimixco on HN
  • Good concise tool

    From 2 comments

Objections

  • Several regexes are wrong or misleading, such as email and IPv6 patterns

    From 3 comments
    • This is really cool! 2 points: 1. it fiddled with my back button which is a bit annoying 2. a better email sample is ``` ^[^@]+@[^@]+\.[^@]+$ ``` which removes the 2 ampersands…
      kitd on HN
    • For the love of god, PLEASE DON’T USE REGEX TO VALIDATE EMAIL. The RegEx of this website ignores plus-addressing, for example. All you need to do to validate email is send a…
      Diti on HN
    • There is no way I would just plop that IPv6 regex into any serious program. :)
      kazinator on HN
  • Only supports JavaScript flavour, flavour not stated clearly

    From 2 comments
    • neat site! clicking an example opens up a playground with live update and explanation and railroad diagrams, similar to sites like regex101[1] and regulex[2] one suggestion would…
      asicsp on HN
    • You're totally right. Right now this tool only supports the javascript flavor of regex. That said, for all the simple expressions shown there it's more or less the same for most…
      geongeorgek on HN
  • Back button behaviour is broken

    From 1 comment
    • This is really cool! 2 points: 1. it fiddled with my back button which is a bit annoying 2. a better email sample is ``` ^[^@]+@[^@]+\.[^@]+$ ``` which removes the 2 ampersands…
      kitd on HN

Requests

  • Support other regex flavours and document differences

    From 2 comments
    • OK, these kinds of regex tools get posted quite often. I get it, regex is very confusing at first. And some of these use-cases result in rather complex expressions nobody should…
      robert_tweed on HN
    • neat site! clicking an example opens up a playground with live update and explanation and railroad diagrams, similar to sites like regex101[1] and regulex[2] one suggestion would…
      asicsp on HN
  • Add more content and crowdsourced regexes

    From 2 comments
    • I'm glad you like the tool <3 It will have a lot more content soon :)
      geongeorgek on HN
    • love the idea! I would crowdsource it so people can add their regex and vote on other people rexgexes!
      hamid_ra on HN

Questions

  • Is the IPv4 diagram repeat count correct

    From 1 comment
    • Is there a bug? In regexp for IPv4: https://ihateregex.io/expr/ip expression ends with {3} but the diagram states "2 times" in lower right - shouldn't it say "3 times"?
      dan_hawkins on HN
  • Diagram source credit to regexper missing in frame

    From 1 comment
    • I don't understand why the Github repository lists regexper as the source of the visual graph code but the frame only shows iHateRegex as watermark? If the only thing that is…
      KenanSulayman on HN

Alternatives named

  • regex101

    From 2 comments
    • My go-to is https://regex101.com/
      strig on HN
    • Nice tool! I personally use https://regex101.com/ as I like the explanations and quick reference.
      xxsaculxx on HN
  • regexr

    From 1 comment
    • Nobody pointed it out, but there's also https://regexr.com/ It's how I learned regex years ago, and I still use it today to test/build more complex patterns.
      darau1 on HN
  • regexper

    From 1 comment
    • Here is my goto resource for checking regexpr with railroad diagrams: https://regexper.com/
      smartmic on HN
  • Patterns app

    From 1 comment
    • if you're on osx, the app Patterns is really good for testing regex, and also has quick references for a variety of regex 'engines' and also has decent matching explanations…
      waz0wski on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/22200584)