
Verbal-Exprejon: Regexes without any regex - macco
https://github.com/GuillaumeBadi/Verbal-Exprejon
======
lokedhs
The Common Lisp regex library cl-ppcre has had this as a feature for a long
time. The library uses a sexp-based format for regexes, but you can also use
plain regex if you want. When you pass a plain regex to it, it will always
parse it into the sexp form first. This gives you the benefit of both the
compact standard regex form as well as the more readable sexp forms at the
same time. For example:

    
    
        (cl-ppcre:parse-string "(?<!\\w)([*_])(.+?)\\1(?!\\w)")
    

Gives the following:

    
    
        (:SEQUENCE
          (:NEGATIVE-LOOKBEHIND :WORD-CHAR-CLASS)
          (:REGISTER (:CHAR-CLASS #\* #\_))
          (:REGISTER (:NON-GREEDY-REPETITION 1 NIL :EVERYTHING)) 
          (:BACK-REFERENCE 1)
          (:NEGATIVE-LOOKAHEAD :WORD-CHAR-CLASS))
    

This may look complicated, but it has to be in order to be able to fully cover
all features of standard regex. I would like to see how complex regexes like
this is represented using Verbal library.

------
pathikrit
Here's mine in Scala:
[https://github.com/pathikrit/ScalaVerbalExpressions](https://github.com/pathikrit/ScalaVerbalExpressions)

