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

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

Re: Help with Emacs Regex


From: Barry Margolin
Subject: Re: Help with Emacs Regex
Date: Wed, 16 Jul 2003 17:40:12 GMT

In article <mailman.124.1058370501.8231.help-gnu-emacs@gnu.org>,
Bill Benedetto  <bbenedetto@goodyear.com> wrote:
>>>> Hortman, Mark writes:
>
>  Mark> I have a rather simple regex question or two I was hoping
>  Mark> someone could help me with.
>  Mark>
>  Mark> I need to match lines that do not begin with " and three numbers, so
>  Mark> 
>  Mark> "300
>  Mark> "400
>  Mark> "50a
>  Mark> abc
>  Mark> 500
>  Mark> 
>  Mark> I need to match all lines but the first two.  I have tried
>  Mark> ^[^"0-9\{3\}]
>  Mark>
>  Mark> Which I, being a regex, emacs newbie interpret as search
>  Mark> for all beginning of lines that dont have a " and then
>  Mark> three numbers.  What gives?
>
>Well...
>
>^[^"] will match all lines that don't begin with a quote.  That
>works in your example above.
>
>^[^"][^0-9][^0-9] will also match and comes closer to what you
>actually asked for.
>
>Note that ^[^"][^0-9][^0-9][^0-9] *SHOULD* work except that it
>doesn't work on your 3-char records.

That doesn't work because it only matches lines where all of the second
through fourth characters are non-digits.  That's why it doesn't allow his
third example line through: the 2nd character is 5, which doesn't match
[^0-9].

-- 
Barry Margolin, barry.margolin@level3.com
Level(3), Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.


reply via email to

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