Re: Trying to define a RE

Patrick Verboom <[email protected]> Tue, 07 Dec 2004 18:58:38 +0100
Newsgroups gmane.comp.jakarta.regexp.user
Message-ID <[email protected]>
Hi,

try this
                String result = null;
                String regexp = "<node-to-find>(.*?)</node-to-find>";
                RE r = new RE(regexp, RE.MATCH_SINGLELINE);
                if (r.match(str)) {
                    result = r.getParen(1);
                }

greetings Patrick


COURTAULT Francois wrote:

>Hello,
>
>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 !
>
>Any idea ?
>
>Regards.
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [email protected]
>For additional commands, e-mail: [email protected]
>
>  
>