zhihuali schreef:

> I was wondering if there's a way to specify "not including this
> phrase" in perl regexp.
> Like such two strings:
> axbcabcd
> axbcacbd
>
> If I say "not including the letter a or the letter b" (=~/[^a^b]/)
> then neither of them will be matched.

The [^a^b] doesn't mean what you think it means. The "^" only has a
special meaning at the start.


> However now I want to say "not
> including the phrase 'ab'", then the string 2 should be matched.
> But I can't figure out how to specify the second condition by regexp.
> Could anyone help me?

There are many ways to do this, but let's play it simple:

    if ( m/ab/ ) {
        # do nothing
    }
    else {
        # do something
    }

-- 
Affijn, Ruud

"Gewoon is een tijger."


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to