RE

Christophe Delord christophe.delord at free.fr
Sun Jan 6 16:26:29 EST 2002


Hello,

In regular expressions, the dot (.) doesn't match newlines.
Try to replace .* by (.|\n)*

Christophe.

Guy Bashan wrote:

> Hello, I'm new to Python and having some Regular expressing problems:
> I want to find a pattern in HTML page. I have the HTML page in a variable
> named data.
> Now I would like to search a pattern that starts with:
> -----------------------------------------------
> <a href="http://news.walla.co.il/ts.cgi?tsscript=item&path=&id=163799"
> class="w2b" style="color: #660000;"><span dir=rtl>
> ------------------------------------------------------
> and ends with:
> </span></a></td>
> 
> in the middle there can be any occurence.
> 
> I wrote:
> 
> result = re.search(r'style="color: #660000;"><span
> dir=rtl>.*</span></a></td>', data);
> if result:
>     print result.group();
> else:
>     print 'no match';
> 
> but it seems like it doesn't work.
> 
> Anyone has ideas ???
> 
> Thanks.
> Bashan.
> 
> 
> 

--
Christophe Delord
http://christophe.delord.free.fr




More information about the Python-list mailing list