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

Retrieving multiline text between 2 words

Last post 07-07-2008, 2:51 PM by ddrudik. 1 replies.
Sort Posts: Previous Next
  •  07-07-2008, 2:44 PM 43827

    Retrieving multiline text between 2 words

    Hello,

     I've a string containing the following data:

    sdfsdfdsf
    sdfsdsdf

    Begin Item
    itemtype                                ordecomplicatie32
    ItemOptions                             00000000000000000001000
    ExtraOptions                            11
    ItemPlane                               0
    taborder                                0
    itemleft                                3915
    itemtop                                 3090
    itemwidth                               4620
    itemheight                              1095
    End Item

    jkghsdkjhsdjhfdsf
    sdfdsf

    Now I need a Regex to get the text between 'Begin Item' and 'End Item' I can't figure this out. This is the expression I've sofar:

    (?s:Begin Item.(?<Text>.\<End Item\>*))

    But it won't stop at 'End Item'

    Could someone advice me please?

    With best regards,

    Alex van der Lans

  •  07-07-2008, 2:51 PM 43828 in reply to 43827

    Re: Retrieving multiline text between 2 words

    This matches your source text as shown:

    (?s)Begin Item(?<Text>.*?)End Item


View as RSS news feed in XML