Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. - Jamie Zawinski

Regular Expressions are difficult to write and maintain. Instead of harping about the problems, I want to explore what Emacs offers to make writing them easier. In particular, I want to tackle the rx macro, the regular s-expression or lispy regular expression.

( require ' s ) ;; All we need is =s-matches-p= ( require ' rx ) ;; Creating a regexp that will match -> <File> [<Line>:<Column] <Suggestion> ( setq this-file-name "blog.org" ) ( s-matches-p ( rx bol ( eval this-file-name ) space "[" ( group ( one-or-more digit ) ) ":" ( group ( one-or-more digit ) ) "]" space ( group ( zero-or-more anything ) ) eol ) "blog.org [17:16] Emacs Lisp, not emacs lisp" ) ;; Produced regexp, I do not want to write or maintain this by hand "^blog\\.org[[:space:]]\\[ \\ ( [[:digit:]]+ \\ ) : \\ ( [[:digit:]]+ \\ ) ][[:space:]] \\ ( \\ (?: . \\ | \\ ) * \\ ) $"

Although it is less concise, the example above illustrates the selling point of writing regular expressions at a higher level: it is more understandable, comfortable to write and easier to maintain. Rather, the "lispyness" of the expressions is more appropriate in the style and heart of Emacs, working with symbolic expressions.