gnu-regexp-users
[Top][All Lists]
Advanced

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

Re: [Regexp] a regexp question


From: Hartwig, Thomas
Subject: Re: [Regexp] a regexp question
Date: Fri, 07 May 2004 20:14:40 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

Sorry for not having a solution, except double processing the strings. Some years ago I found a regexp definition where strings could be defined as parts of a character class something for your problem would look like that: ^[^[:puppy:]]*kitty

But I can't remember where it was. However, I have your problem like you sometimes as well, but rewrite it with some kind of double processing. The manpage of perlre contains a solution for that as well. Look for "Extended Patterns"

Finaly I wanted to affirm your problem and say that I'm interested in a standard solution as well.

Who knows about that?

Cheers
Thomas

Levent Yilmaz wrote:
Hello,

It sounded like a very simple problem but I couldn't come up with a solution. I was trying to do this with Basic Regexp in grep:

Find all lines which contain the word 'kitty'. But only those lines that do not have 'puppy' somewhere before 'kitty'. For instance:

my kitty is very cute
but puppy is cuter than kitty

What regular expression stands for the first line but not the second? Note that the other way is very easy, that is the lines with 'puppy' followed by 'kitty': puppy.*kitty

thank you so very much!
-Levent.


PS: What is all this spam on the list by the way?



_______________________________________________
Gnu-regexp-users mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/gnu-regexp-users

--
Thomas Hartwig - Software & IT-Service Specialist

Attachment: t.hartwig.vcf
Description: Vcard


reply via email to

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