Regular expressions that work "everywhere"

(johndcook.com)

18 points | by ColinWright 2 days ago

7 comments

  • JdeBP 19 minutes ago
    The author is circling around, but not quite reaching, a statement that POSIX Basic Regular Expressions work everywhere, with the caveat that that not everyone has caught up with version 8 of the Single Unix Specification, which has slightly changed BREs.
  • agnishom 21 minutes ago
    A while ago, we wrote a paper about finding regexes which match the same way in both the greedy semantics and the leftmost maximal semantics.

    https://par.nsf.gov/servlets/purl/10534654

  • MathMonkeyMan 1 hour ago
    I've always been a stickler for being specific about which regex language your thing accepts, and whether it is to match any substring, or a prefix, or a suffix, or the whole thing, or a line, or a substring of a line, or whatever.

    Here are some of the [more popular][1] ones, and then there are PCRE and Python.

    It took me a while to learn that some of the older ones you see in e.g. grep are [specified by POSIX][2].

    [1]: https://cppreference.com/cpp/regex#Regular_expression_gramma...

    [2]: https://pubs.opengroup.org/onlinepubs/009696899/basedefs/xbd...

  • LoganDark 33 minutes ago
    > the special characters . * ^ $

    These already do not work in many tools which require those special characters to be escaped to have any meaning. An easy example is GNU grep, sed, etc. which use BRE ("Basic Regular Expressions") by default. The article mentions GNU coreutils but does not explain that `-E` is required to fix that behavior.

  • Resonix 2 days ago
    why I built this
    • greazy 35 minutes ago
      I think you forgot to post a link?
  • ngruhn 20 minutes ago
    [dead]