Mailing List Archive


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

Re: [tlug] Regexp



On Wed, 5 May 2004 08:59:19 -0400, Josh Glover <tlug@example.com> wrote:
> Quoth Daniel Quimper (Wed 2004-05-05 06:24:39PM +0900):
>
>> Seriously, I need to parse out a much longer string then just "abc". And
>> looking at what you wrote, the regexp would be too long to be
>> implementable.
>
> Do it in Perl, if you have the option:
>
> $line !~ /abc/;

Change the software is not an option because it's already parsing other
string. So I can not change the "if" statement to inverse it.

Also, I found a wierd syntax what would negate a string. Something like:

(?!abc)

But, I got two problem with it. First it's not implemented in the language
the software is written in. And second, it requires to add something in
front of it to work properly. Like if I knew that the string I want to  
accept
all have numbers before the potentially present "abc", I could write:

[0-9]+(?!abc)

But as I want to accept all other strings except those that include "abc".  
It's
not possible. btw, this doesn't work:

.*(?!abc)

> And if Perl is not an option, maybe you can still use it to generate the
> ridiculous regexp that Dr. Turnbull (he *is* a Doctor of Regexpology,
> you know)[1] spewed your way.

Generating the regexp with a scripting language would would be an  
interesting
exercise... I'm not sure I'm up to it though... :) If anyone have the time  
to
try, please let me know. Maybe Dr. Turnbull[2] can amaze us with his  
skills :)

> [1] D:IAALB (Disclaimer: I Am A Lying Bastard)
[2] D:IAAFB (Disclaimer: I Am A Fervent Beleiver)

dan...


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links