Regular Expression question

李政 fzhenglee23 at yahoo.com.cn
Wed Jun 7 18:29:10 EDT 2006


I'm sorry! I mean pattern is an argument of the function, in this case, how I process special charactors.
        patter = 'www.'                   # not this 
      if re.compile(pattern).match(string) is not None:
          ......
   
  but not:
   
      if re.compile(r'www.').match(string) is not None:           
  or
      if re.compile('www\.').match(string) is not None: 
   
  , how you process special characters, like dot.



Fredrik Lundh <fredrik at pythonware.com> wrote:   ken.carlino at gmail.com wrote:

> I am new to python regular _expression, I would like to use it to get an
> attribute of an html element from an html file?

if you want to parse HTML, use an HTML parser. if you want to parse 
sloppy HTML, use a tolerant HTML parser:

http://www.crummy.com/software/BeautifulSoup/



-- 
http://mail.python.org/mailman/listinfo/python-list

 __________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20060608/39492a4a/attachment.html>


More information about the Python-list mailing list