Python's RE

Evgeny Zemlerub oblom at barak-online.net
Mon Jun 5 05:59:53 EDT 2000


Hi.

How exectly do I something that reassembles perl's :

$string = "qwerwe kkljlksdfg (first string) asdkjflkjg
(secondstring)jlskjlfdkg(one more string)";
@words = ($string =~ /\((.+?)\)/smg);
foreach(@words){
        print "$_\n";
}
                                            ?

the closest thing that i got is :
 print re.search(r'\((.+?)\)',
'aaa(foo)bbb(bar)asdfsadf',re.S|re.M).groups()

but it doesn't returns what i expected

Thanks in advance,
    Evgeny




More information about the Python-list mailing list