This discussion is archived
3 Replies Latest reply: May 31, 2008 8:13 PM by 807591 RSS

String replaceFirst

807591 Newbie
Currently Being Moderated
Hi,
I have some string in the form .* <% .* %> .* <% .* %> .* etc.
example:
<h1>Hello <% out.print(params.get("name")[0]); %>!</h1> <% for%> Hello2

I want to erase from the string all the characters until the first "<%".
I have tried to use str.replaceFirst(".*<%","");
but then it cuts all the string till the last "<%" (i.e. gives me the string " for%> Hello2").
what can I do?

thanks