[Tutor] a re question
Ignacio Vazquez-Abrams
ignacio@openservices.net
Thu, 4 Oct 2001 23:41:43 -0400 (EDT)
On Fri, 5 Oct 2001, Newbie Python wrote:
> How can use re to match something like:
> js="""
> <script language="JavaScript">
> blahblahblahblahblahblahblah
> blahblahblahblah
> blahblahblahblah
> </script>
> """
>
> I use this:
> re.match(r"<script.+?</script>",js,re.S)
> but it will not match..
>
> Can you please tell me why and how to write the regex?
There's a newline in the beginning of your string. Use
".*<script[^>]*>.*</script>.*" instead.
--
Ignacio Vazquez-Abrams <ignacio@openservices.net>