regexp RE.subst() issue
"PISOLKAR,ASHISH (HP-Roseville,ex1)" <[email protected]> Mon, 15 Sep 2003 17:50:24 -0700
| Newsgroups | gmane.comp.jakarta.regexp.user |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I am using the RE.subst method.Here is the code on one of my JSP pages.this
is very similar to the example in the docs of the RE
<%
RE r = new RE("( http://[\\.\\w\\-\\?/~_@ <http://[///w//-//?/~_@&=%>
&=%]+)");
String toSubsWith="<a href=\"$0\">$0</a>";
String tempBefStr=r.subst(strDescription,toSubsWith);
%>
strDescription has in it http://something <http://something/> .WHat is
happening is it is finding the http: but while substituting it is
substituting the $0 instead of the whole match.
For example if strDescription =Welcome to http:/www.yahoo.com isnt it great
The string getting returned is "Welcome to $0 isnt it great"
I have tried using
String toSubsWith="<a href=\"$&\">$&</a>";
but that dint help.Am I missing something?I am using the
jakarta-regexp-1.3.jar
Thanks AP