regex help

Discussion in 'Perl' started by Paul, Nov 28, 2003.

  1. Paul

    Paul Guest

    hi,

    i am trying to find a specific word in several html pages, that is _not_
    italic, which means not in any case bordered by an <i>-tag.

    e.g.

    match:
    <b><i>word</i></b>
    <i><b><span>word</span></b></i>
    <i>word</i>

    non-match:
    word
    <b>word</b>

    i don't really know how to meet this condition, so your help would be
    very appreciated.

    thank you,
    Paul
     
    Paul, Nov 28, 2003
    #1
    1. Advertising

  2. Paul wrote:
    > i am trying to find a specific word in several html pages, that is
    > _not_ italic, which means not in any case bordered by an <i>-tag.
    >
    > e.g.
    >
    > match:
    > <b><i>word</i></b>
    > <i><b><span>word</span></b></i>
    > <i>word</i>
    >
    > non-match:
    > word
    > <b>word</b>
    >
    > i don't really know how to meet this condition, so your help would be
    > very appreciated.


    Congratulations. You just re-discovered that regular expressions are not the
    right tool for parsing HTML.
    Solution: Use a proper HTML parser like HTML::parser or one of its cousins
    and just define a callback function for the <i> tag.

    jue
     
    Jürgen Exner, Nov 28, 2003
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SmViQnVzaGVsbA==?=

    Is ASP Validator Regex Engine Same As VS2003 Find Regex Engine?

    =?Utf-8?B?SmViQnVzaGVsbA==?=, Oct 22, 2005, in forum: ASP .Net
    Replies:
    2
    Views:
    712
    =?Utf-8?B?SmViQnVzaGVsbA==?=
    Oct 22, 2005
  2. Rick Venter

    perl regex to java regex

    Rick Venter, Oct 29, 2003, in forum: Java
    Replies:
    5
    Views:
    1,635
    Ant...
    Nov 6, 2003
  3. Replies:
    2
    Views:
    601
  4. Xah Lee
    Replies:
    1
    Views:
    944
    Ilias Lazaridis
    Sep 22, 2006
  5. Replies:
    3
    Views:
    770
    Reedick, Andrew
    Jul 1, 2008
Loading...

Share This Page