Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

recursive regex

Last post 06-12-2007, 1:49 AM by Aussie Susan. 2 replies.
Sort Posts: Previous Next
  •  06-08-2007, 5:58 PM 31377

    recursive regex

    Hi,

    I have never done recursive regex before. What I am trying to do is if there is a string like this:

     
    Soem other text
    <span name="form1"><input type="text" name="" value=""><input type="checkbox" name="" value=""><span name="form2"><input type="radio"><input type="text"></span>somasjgjasha</span>teskjhajs<span>test text</span>a.jkahsk

     
    Is it possible to return all the string inside <span name="form1"></span> without including the last "test text".

  •  06-09-2007, 3:09 PM 31707 in reply to 31377

    Re: recursive regex

    Since you have nested spans I guess I would try:

    <span name="form1">.*?</span>.*?</span>

    Which would match:

    <span name="form1"><input type="text" name="" value=""><input type="checkbox" name="" value=""><span name="form2"><input type="radio"><input type="text"></span>somasjgjasha</span>

    Is that what you were looking for?


  •  06-12-2007, 1:49 AM 31784 in reply to 31377

    Re: recursive regex

    Some questions that might let people help you more:

    1) What language are you using?

    2) is the 'name="form1" constant in the source text?

    3) are you really looking for the text between matching '<span...>' and '</span>' tags
     

View as RSS news feed in XML