Re: Trying to define a RE
Kevin Rodgers <[email protected]> Tue, 7 Dec 2004 11:42:35 -0700
| Newsgroups | gmane.comp.jakarta.regexp.user |
|---|---|
| Message-ID | <[email protected]> |
COURTAULT Francois writes: > I have a java String which is : > > "<test>\n\t<test2>XXXX</test2>\n\t<test3>YYYY</test3>\n\t<node-to-find>\n\t\t<tt>\n\t\t\t<ttt>vvvv</ttt>\n\t\t</tt>\n\t</node-to-find>\n</test>" > > I want to search a RE which begins by <node-to-find> and ends by </node-to-find> inside these two strings, you can have any character. > > How can you define the RE for that purpose ? I have tried <node-to-find>.*</node-to-find> > without success ! I think the problem is that "." matches any character other than newline, and your string obviously contains newlines. So instead of ".*", you need something like "(.*\n?)*". -- Kevin Rodgers