Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the constructed the following regular expresion using rx.el module

   (rx (and bol (0+ (not (any "#" "[]*" "\n")))  " " (or "#" "[]*") " "))

I want to change the string []* for the string ~=[,,_,,]:3 but when I write the following

(rx (and bol
             (0+ (not (any "#" "~=[,,_,,]:3" "\n")))
             " "
             (or "#" "~=[,,_,,]:3")
             " "))

rxt-explain shows that that it is getting compiled to the wrong regexp

(sequence line-start
            (any "~" "[" ":" "," "\n" "]" "#" "3" "=" "_")))
          " "
           (any "#")
          " ")

Any ideas on how to fix the regexp expresion so that it treats the "~[,,_,,]:3" as a group?

share|improve this question
Could you post a example of a string you expect to match, or rather an example of a string that you would like to avoid? Because your square brackets notation seems weird to me. It might not be what you expect. – Seki Jul 23 '13 at 7:26
It is basically to detect the eshell prompt. The []* is a short emoticon of nyan-cat's while the latter is longer one. What I would like to match 0 or more characters that don't have this two characters "\n" and "#" and nor the string "~[,,_,,]:3" which in the original regexp prompt was "$" – PuercoPop Jul 23 '13 at 13:32
Frigging rx.el. It is creating a problem by its very existence. Regular Expressions are well defined, well known, in broad use. rx.el comes along and invents a NEW! BETTER! NOVEL!!! syntax that we all need to learn. Wrong idea. What problem are we solving here? – Cheeso Apr 21 '14 at 18:19

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.