Volunteer .NET Evangelist

A well oiled machine can’t run efficiently, if you grease it with water.
  首页  :: 联系 :: 订阅 订阅  :: 管理

Regex 101 Exercise I6 - Remove font directives from HTML

Posted on 2006-02-04 21:30  Sheva  阅读(326)  评论(0编辑  收藏  举报
    Eric Gunnerson has come up with a great number of excellent regular expression exercises in his personal blog, and I will keep my blog sync with his whenever a new exercise is introduced there.
    In this episode, the exercise is to remove font directives from HTML.
    -----------------------------------------------------------------------------------------------------
    Answer1:
<font.*?>|</font> (Eric Gunnerson)
    Answer2:</?font.*?> (Maurits)
    Answer3:
</?font[^>]*> (Kbiel)

    Maurits' regex pattern is the shortest one.