help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RegExp question


From: Greg Hill
Subject: Re: RegExp question
Date: Thu, 23 Sep 2004 11:05:29 -0700

Ryan,

Depending on exactly what you are trying to accomplish, this may or may not do the trick for you.  For example, if the word "repeat" is followed by a space character, the space character _will_ be part of the match.  But if the word you are searching for is always at the end of a line, this should do what you want.


(re-search-forward "repeat\\(-[xy]?\\)?\\([^:\n]+\\|$\\)")

If your requirements are more complicated, it may be necessary to write your own function that does more than just a single call to re-search-forward.

--Greg

At 9:41 AM -0700 9/23/04, Ryan Bowman wrote:
I have a regexp "repeat\\(-[xy]?\\)?" this should
match
repeat
repeat-x
repeat-y
, which it does, however it also matches
background-repeat:
which I don't want it to.
So I changed it to this "repeat\\(-[xy]?\\)?[^:]"
so it won't match background-repeat: but then it no
longer matches repeat,
I assume because [^:] actually means to match
something, but not a ':'
so how do I specifiy that I don't care if anything
follows the patter or not,
so long as it is NOT ':'?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]