Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
          (zero-or-more
           (not
            (any "~" "[" ":" "," "\n" "]" "#" "3" "=" "_")))
          " "
          (or
           (any "#")
           "~=[,,_,,]:3")
          " ")

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

share|improve this question
1  
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 at 18:19

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.