Re: OT: simple regex question

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

 



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@xxxxxxxxxx>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux