Regex and Multiline patterns

Discussion in 'Questions (Windows Mobile)' started by DaveW, Nov 9, 2008.

  1. DaveW

    DaveW Active Member Licensed User

    I need to make a pattern that will match (simple) XML structures over multiple lines. I am using:

    XMLParse.New2("<" & Element & "\b[^>]*>(.*?)</" & Element & ">",True,True)

    This works fine with elements that are on one line but it does not work on multiline elements. I thought that perhaps there was a problem with the Multiline switch but I suspect it has more to do with my Regular expression. (multiline affects the ^ and $ and there are none in my expression)

    Is there a Regex expert who can help?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    Quote from: Regex Tutorial - The Dot Matches (Almost) Any Character

    So you should use something like:
    Code:
    XMLParse.New2("<" & Element & "\b[^>]*>((.|\r\n)*?)</" & Element & ">",True,True)
     
  3. DaveW

    DaveW Active Member Licensed User

    Thanks, That fixed it :)
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice