crocs

Dev tools

regex builder

SHOW HN2017

105points
55comments
#434of 2,242 in 2017
Top 20%of 2017 by points

How HN took it

MixedNo clear lean

4 positive, 7 neutral or asking, 1 mixed, 9 critical, out of 21 comments about the project. Thread score -0.23.

Idea: 4 for, 4 againstDesign: 0 for, 5 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

  • Readable and easier to reason about than raw regex

    From 2 comments
    • I have a similar lib in JS that uses either regexps or plain strings for the leafs, and combinators to implement the various regexp operators. It is useful for maintainability.…
      pygy_ on HN
    • I always wanted to do something like this. Because I always forgot how to do the 'look ahead' assertions. I even named the library 'hu_regex', where 'hu' stands for human, but…
      rajaravivarma_r on HN
  • Interesting idea similar to existing combinator libraries

    From 2 comments
    • Regex combinators are quite common in functional languages (where it works quite better than in python). One particular advantage compared to Regex syntax is that you stay inside…
      Drup on HN
    • I always liked this idea (reminiscent of emacs rx dsl). But I'm not sure I'd be using it that often...
      agumonkey on HN

Objections

  • Harder to learn than standard regex syntax

    From 2 comments
    • Really cool concept, yet not practical in my opinion. The classes and functions called to replace the regex I consider to be harder to learn than the initial regex. With regex…
      matthberg on HN
    • I don't really think this is more readable than the regex itself once it starts to get complex, like they all do. Maybe if this was implemented on a prefix notation language it…
      stonewhite on HN
  • Debugging errors is hard since it delegates to Python re

    From 1 comment
    • (Separate comment addressing the library itself.) I find the naming of the classes off. Why not call X as Any? Why use nouns for some things, and verbs for others? I found…
      reikonomusha on HN
  • Naming of classes is confusing (Include, Exclude, Seq, Times)

    From 2 comments
    • (Separate comment addressing the library itself.) I find the naming of the classes off. Why not call X as Any? Why use nouns for some things, and verbs for others? I found…
      reikonomusha on HN
    • I also think the naming is really bad and can be improved. The central problem is that you're using action words for a descriptive API. You should use something like "Repeating"…
      Asooka on HN
  • Regexes are rarely generated programmatically, so little need

    From 1 comment
    • How often do you programmatically generate regexes though? I tend to find that regex patterns are effectively constants in the program And if it's just for readability it seems a…
      anentropic on HN

Requests

  • Operator overloading for repeats and alternation

    From 2 comments
    • Interesting, how does this compare to PyParsing[1]? It seems that pyparsing does a lot of this already. Not that you shouldn't write your own, mind you! Some improvements could…
      orf on HN
    • I also think the naming is really bad and can be improved. The central problem is that you're using action words for a descriptive API. You should use something like "Repeating"…
      Asooka on HN
  • Rename classes to more descriptive names

    From 3 comments
    • (Separate comment addressing the library itself.) I find the naming of the classes off. Why not call X as Any? Why use nouns for some things, and verbs for others? I found…
      reikonomusha on HN
    • I also think the naming is really bad and can be improved. The central problem is that you're using action words for a descriptive API. You should use something like "Repeating"…
      Asooka on HN
    • Seq is odd, to me Seq('a', 'm') says it matches 'am'. Why not overload X to support filtered forms instead? E.g X() is ".", X(from_, to_) is $from-$to, X(items) is [$items] and…
      masklinn on HN
  • Support for parsing existing regexes

    From 1 comment
    • (Separate comment addressing the library itself.) I find the naming of the classes off. Why not call X as Any? Why use nouns for some things, and verbs for others? I found…
      reikonomusha on HN

Questions

  • How does this compare to pyparsing or parser combinators

    From 2 comments
    • Interesting, how does this compare to PyParsing[1]? It seems that pyparsing does a lot of this already. Not that you shouldn't write your own, mind you! Some improvements could…
      orf on HN
    • Hi, what's the diference between this project and a parser combinator?
      carlochess on HN
  • Why not use Python verbose regex mode

    From 1 comment
    • I'm confused. Doesn't Python offer verbose regular expressions complete with comments? https://docs.python.org/3/library/re.html#re.VERBOSE ``` a = re.compile(r"""\d + # the…
      ddebernardy on HN

Alternatives named

  • rx.el in Emacs

    From 1 comment
    • In case you aren't aware of this, what you've made is very similar to the rx.el[1] that's shipped with Emacs since 21.1 (released in 2001). Many of the comments here are…
      avar on HN
  • CL-PPCRE tree syntax

    From 1 comment
    • In Common Lisp, the library CL-PPCRE [0] is used for regexes, and has an "AST"-syntax like this. It supports full Perl-compatible regular expressions in both the tree syntax as…
      reikonomusha on HN
  • pyparsing

    From 1 comment
    • Interesting, how does this compare to PyParsing[1]? It seems that pyparsing does a lot of this already. Not that you shouldn't write your own, mind you! Some improvements could…
      orf on HN
  • Python VerbalExpressions

    From 1 comment
    • A more mature version: https://github.com/VerbalExpressions/PythonVerbalExpressions
      rohitpaulk on HN
  • compose-regexp.js

    From 1 comment
    • I have a similar lib in JS that uses either regexps or plain strings for the leafs, and combinators to implement the various regexp operators. It is useful for maintainability.…
      pygy_ 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/14731631)