RegExp between tags

Discussion in 'ASP .Net' started by Charles Taylor, Apr 8, 2005.

  1. I have a regular expression problem that is driving me crazy.

    How do you capture the stuff between two closed html tags i.e

    <b>One</b>


    Capture all this 'stuff'
    <em>dkskldsd</em>
    <table>
    <tr><td></td></tr></table>

    <b>Two</b>


    this suprisingly doesnt work, it captures the <b> tags but not the 'stuff'

    (?:<b>(?<bold>.*?)</b>)
    (.|\s)*?

    TIA
     
    Charles Taylor, Apr 8, 2005
    #1
    1. Advertising

  2. Hi,

    I did not get the question. Can you clarify?

    "(?:<b>(?<bold>.*?)</b>)(.|\s)*?" does capture "<b>Two</b>" as "bold = Two"

    What do you mean by "all that stuff"? Your regexpression is made to only
    capture the b tags.





    "Charles Taylor" wrote:

    > I have a regular expression problem that is driving me crazy.
    >
    > How do you capture the stuff between two closed html tags i.e
    >
    > <b>One</b>
    >
    >
    > Capture all this 'stuff'
    > <em>dkskldsd</em>
    > <table>
    > <tr><td></td></tr></table>
    >
    > <b>Two</b>
    >
    >
    > this suprisingly doesnt work, it captures the <b> tags but not the 'stuff'
    >
    > (?:<b>(?<bold>.*?)</b>)
    > (.|\s)*?
    >
    > TIA
    >
     
    =?Utf-8?B?RXRoZW0gQXp1bg==?=, Apr 8, 2005
    #2
    1. Advertising

  3. Charles Taylor

    Nergal Guest

    Hi,

    By 'stuff' I mean anything that's between the ( closed ) bold tags.

    This I was hoping to capture with (.|\s)*?

    I'm attempting to capture the repeating pattern of bold tags followed by
    other html.

    Hope this clarifys it and thanks for your help.

    "=?Utf-8?B?RXRoZW0gQXp1bg==?=" <>
    wrote in news::

    >
    > Hi,
    >
    > I did not get the question. Can you clarify?
    >
    > "(?:<b>(?<bold>.*?)</b>)(.|\s)*?" does capture "<b>Two</b>" as "bold =
    > Two"
    >
    > What do you mean by "all that stuff"? Your regexpression is made to
    > only capture the b tags.
    >
    >
    >
    >
    >
    > "Charles Taylor" wrote:
    >
    >> I have a regular expression problem that is driving me crazy.
    >>
    >> How do you capture the stuff between two closed html tags i.e
    >>
    >> <b>One</b>
    >>
    >>
    >> Capture all this 'stuff'
    >> <em>dkskldsd</em>
    >> <table>
    >> <tr><td></td></tr></table>
    >>
    >> <b>Two</b>
    >>
    >>
    >> this suprisingly doesnt work, it captures the <b> tags but not the
    >> 'stuff'
    >>
    >> (?:<b>(?<bold>.*?)</b>)
    >> (.|\s)*?
    >>
    >> TIA
    >>




    --
    ¬¬¬¬nergal¬¬¬¬
     
    Nergal, Apr 8, 2005
    #3
    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. Thierry Lam
    Replies:
    7
    Views:
    414
    Neredbojias
    May 2, 2009
  2. Greg Hurrell
    Replies:
    4
    Views:
    167
    James Edward Gray II
    Feb 14, 2007
  3. Joao Silva
    Replies:
    16
    Views:
    381
    7stud --
    Aug 21, 2009
  4. replacing tags between tags

    , Sep 18, 2005, in forum: Perl Misc
    Replies:
    9
    Views:
    136
    Jürgen Exner
    Sep 19, 2005
  5. MB
    Replies:
    3
    Views:
    118
    Evertjan.
    Mar 29, 2007
Loading...

Share This Page