Regular Expressions
Charles Thornhill-Cole
s311199 at student.uq.edu.au
Mon Sep 27 04:46:43 EDT 1999
On Mon, Sep 27, 1999 at 09:19:48AM +0200, Karl Kreiner wrote:
> Hi,
> I have following problem . I have a multi-line string containing
> several patterns I have to match.
> The problem is, that my patterns may span several lines . The question
> is : How can I express a
> regular expression , that ignores line-feeds and carriage returns ?
> I'm using the module "RE" and the method "search".
>
> thx in adv
> Charly
>
The DOTALL option may be what you're after:
mysearch = re.compile(pattern, re.DOTALL)
result = mysearch.search(string)
It lets '.' match any character at all, including a newline.
HTH
--
Charles Thornhill-Cole
cat at uq.net.au
More information about the Python-list
mailing list