multi-line pattern matching in pyhon

Posted by Horace Ho on Stack Overflow See other posts from Stack Overflow or by Horace Ho
Published on 2010-04-27T09:25:38Z Indexed on 2010/04/27 9:33 UTC
Read the original article Hit count: 315

Filed under:
|
|

A periodic computer generated message (simplified):

Hello user123,

- (604)7080900
- 152
- minutes

Regards

Using python, how can I extract "(604)7080900", "152", "minutes" (i.e. any text following a leading "- " pattern) between the two empty lines (empty line is the \n\n after "Hello user123" and the \n\n before "Regards"). Even better if the result string list are stored in an array. Thanks!

© Stack Overflow or respective owner

Related posts about python

Related posts about regex