On 26/04/06, Liam Clarke <[EMAIL PROTECTED]> wrote:
> Hi Frank, just bear in mind that the pattern:
>
> patObj = re.compile(".*", re.DOTALL)
>
> will match
>
>
>This is my title
>
>
> But, it'll also match
>
>
>This is my title
>
> Some content here
>
> Another title; not going to
Liam Clarke wrote:
> To the Tutor list - can't re.MULTILINE also be used? I've never really
> used that flag.
re.MULTILINE affects the meaning of ^ and $ - do they match only the
beginning and end of the target string (the default) or do they match
the beginning or end of any line in the string
Hi Frank, just bear in mind that the pattern:
patObj = re.compile(".*", re.DOTALL)
will match
This is my title
But, it'll also match
This is my title
Some content here
Another title; not going to happen with a title tag in HTML, but
more an illustration
All of that.
Got to wa
Kent Johnson wrote:
>Use your compiled regex for the sub(), so it will have the DOTALL flag set:
>html_text = p.sub(replace_string, html_text)
>
>
Kent,
I was trying to work out how to use the DOTALL flag with the sub method,
but couldn't figure it out.
It's so obvious once someone points it o
Frank Moore wrote:
> Hi,
>
> Can anyone tell me how to do a regex substitution across multiple lines
> in HTML?
> I can search for the piece of HTML I want to substitute, for instance:
>
>
> This is my title
>
>
> using
>
> html_text = file('some.html', 'r').read()
> search_string = '.*'