extracting a pattern using RE
Peoter Veliki
peoter_veliki at hotmail.com
Thu Nov 29 20:02:11 EST 2001
More information about the Python-list mailing list
Thu Nov 29 20:02:11 EST 2001
- Previous message (by thread): extracting a pattern using RE
- Next message (by thread): extracting a pattern using RE
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In perl you can use variables within regular expressions to extract patterns, something like this: string ~= /\((.*)\)/g pattern = $1 Probably not correct, but it is attempting to extract text surrounded by parenthes if string equals '(hello)', pattern would equal 'hello'. How can this be done in Python? I also am having problems with recursive patterns, what if I want to do the same thing with string = '(hello (there))' , I want to be able to extract both 'hello (there)' and 'there'. Thanks -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-list/attachments/20011129/c097432c/attachment.html>
- Previous message (by thread): extracting a pattern using RE
- Next message (by thread): extracting a pattern using RE
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list