Hi,
Thanks a lot for useful hints to all of you who replied to my question.
I could easily do now what I wanted.
Cheers,
Zdenek
Holger Berger wrote:
> Hi,
>
> yes:
>
> import re
>
> a="""
> I Am
> Multiline
> but short anyhow"""
>
> b="(I[\s\S]*line)"
>
> print re.search(b, a,re.MULTILINE).gro
Hi,
yes:
import re
a="""
I Am
Multiline
but short anyhow"""
b="(I[\s\S]*line)"
print re.search(b, a,re.MULTILINE).group(1)
gives
I Am
Multiline
Be aware that . matches NO newlines!!!
May be this caused your problems?
regards
Holger
Zdenek Maxa wrote:
> [EMAIL PROTECTED] wrote:
On May 29, 11:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I would like to perform regular expression replace (e.g. removing
> everything from within tags in a XML file) with multiple-line pattern.
> How can I do this?
>
> where = open("filename").read()
> multilinePattern = "^
> Od: Zdenek Maxa <[EMAIL PROTECTED]>
> Předmět: Re: multiline regular expression (replace)
> Datum: 29.5.2007 13:46:32
>
> [EMAIL PROTECTED] wrote:
> > On May 29, 2:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote:
> >
Zdenek Maxa wrote:
> [EMAIL PROTECTED] wrote:
>> On May 29, 2:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote:
>>
>>> Hi all,
>>>
>>> I would like to perform regular expression replace (e.g. removing
>>> everything from within tags in a XML file) with multiple-line pattern.
>>> How can I do this?
>
[EMAIL PROTECTED] wrote:
> On May 29, 2:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote:
>
>> Hi all,
>>
>> I would like to perform regular expression replace (e.g. removing
>> everything from within tags in a XML file) with multiple-line pattern.
>> How can I do this?
>>
>> where = open("filename"
On May 29, 2:03 am, Zdenek Maxa <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I would like to perform regular expression replace (e.g. removing
> everything from within tags in a XML file) with multiple-line pattern.
> How can I do this?
>
> where = open("filename").read()
> multilinePattern = "^ <
Hi all,
I would like to perform regular expression replace (e.g. removing
everything from within tags in a XML file) with multiple-line pattern.
How can I do this?
where = open("filename").read()
multilinePattern = "^ <\/tag>$"
re.search(multilinePattern, where, re.MULTILINE)
Thanks great