XR converts Emacs regular expressions to the structured rx form, thus
being an inverse of
rx. It can also find mistakes and questionable
constructs inside regexp strings.
It can be useful for:
- Migrating existing code to rx form
- Understanding what a regexp string really means
- Finding errors in regexp strings
It can also parse and find mistakes in skip-sets, the regexp-like
The xr package can be used interactively or by other code as a library.
(xr-pp "\\`\\(?:[^^]\\|\\^\\(?: \\*\\|\\[\\)\\)")
(seq bos (or (not (any "^")) (seq "^" (or " *" "["))))
From GNU ELPA:
M-x package-install RET xr RET
Functions parsing regexp strings:
|convert regexp to rx|
|convert regexp to rx and pretty-print|
|find mistakes in regexp|
Functions parsing skip sets:
|convert skip-set to rx|
|convert skip-set to rx and pretty-print|
|find mistakes in skip-set|
|pretty-print rx expression to string|
The relint package uses xr to find regexp mistakes in elisp code.