regexp

Jonathan Curran jonc at icicled.net
Tue Dec 19 14:37:38 EST 2006


On Tuesday 19 December 2006 13:15, vertigo wrote:
> Hello
>
> I need to use some regular expressions for more than one line.
> And i would like to use some modificators like: /m or /s in perl.
> For example:
> re.sub("<script.*>.*</script>","",data)
>
> will not cut out all javascript code if it's spread on many lines.
> I could use something like /s from perl which treats . as all signs
> (including new line). How can i do that ?
>
> Maybe there is other way to achieve the same results ?
>
> Thanx

Take a look at Chapter 8 of 'Dive Into Python.' 
http://diveintopython.org/toc/index.html

You can modify the code there and get the results that you need. Buy the book 
if you can :) It has lots of neat examples.

- Jonathan Curran



More information about the Python-list mailing list