1

I mean something like https://rubular.com/ where I can enter text and experiment with regular expressions to match that text.

7
  • I have found regex-tool on melpa and will try it. Commented May 19, 2022 at 13:06
  • 2
    You can also try M-x re-builder. It is shipped with Emacs.
    – Tobias
    Commented May 19, 2022 at 13:11
  • 1
    I have seen it. But is there documentation that explains how to use it? Commented May 19, 2022 at 13:13
  • masteringemacs.org/article/… Note, you can also switch the syntax via the Re-builder menu.
    – Tobias
    Commented May 19, 2022 at 13:14
  • Do you understand it? Can you answer additional questions? In regex-tool I can have instant visual feedback when I try regular expressions and everything is self-explanatory. I do not understand re-builder commands and do not understand what to expect. Do you know of any readable example? Commented May 19, 2022 at 13:16

1 Answer 1

4

The documentation for re-builder is a bit sparse. You can see the basics via C-h f re-builder:

This command makes the current buffer the "target" buffer of the regexp builder. It displays a buffer named "RE-Builder" in another window, initially containing an empty regexp.

As you edit the regexp in the "RE-Builder" buffer, the matching parts of the target buffer will be highlighted.

To use it, you open a file with the text you want to test your regexps with. Then you call M-x re-builder. A new window will be created at the bottom of the screen, with the empty regexp "" in it. As you add text to the regexp, matches in the target buffer are highlighted, and match groups are given different colours:

enter image description here

More details are found at the article @Tobias linked from Mastering Emacs

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.