Click to See Complete Forum and Search --> : regex for matching between tags


psychomachine
08-07-2005, 08:18 AM
i have an xml segment which looks like this:

<s xml:id="X">Some text.</s><s xml:id="Y">Some other text.</s><s xml:id="Z">Some other text.</s>

I am new to regular expressions, but I would like to match the text between s tags.

I've tried with: (<s.+>).+</s> which is a good start, but it matches everything from the first s tag to the last one. Now, I realize that I need to enter the negation somewhere (i.e. tell the the regex engine what NOT to match) so that it would not allow all these other tags between the first and the last tag, but I haven't been able to come up with anything that works.

Any tips would be greatly appreciated.

All best,
Tench

psychomachine
08-07-2005, 01:08 PM
this is the answer: (<s[^>]*>)([^<]+)</s>