OT: simple regex question

Dario Lesca d.lesca at solinos.it
Mon Apr 23 12:05:35 UTC 2007


Il giorno lun, 23/04/2007 alle 12.36 +0100, Matt Davey ha scritto:

> echo "aa bb cc dd" | perl -pe 'exit(!(/(?=.*\bbb\b)(?=.*\bdd\b)/));'
>     && echo found

Ok, Work!

last question ... (and many thanks if you have a little time to spend
for me)

if I want convert this format into if/else statement.... like this:

$str="aa bb cc dd"
if ($str =~ /.*(\bb|dd)\b/i)
{
        print "***\nYes, Match!\n***\n";
}
else
{
        print "Non match!\n";
}

It's possible? .. (I am not a perl guru, then I do not how to convert
the previous format in this newer) ....

Thanks.

-- 
Dario Lesca <d.lesca at solinos.it>




More information about the fedora-list mailing list