> Hi Everyone,
>
[quoted text clipped - 4 lines]
> Expressions API are welcome.
> Thanks.
What you want to do is a regex-replace:
body.replaceAll( < regex >, "<a href=\"$0\">$0</a>");
The 0-th group is the entire matched string; the dollar-signs represent
matching per
<http://java.sun.com/javase/6/docs/api/java/util/regex/Matcher.html#appendReplace
ment(java.lang.StringBuffer,%20java.lang.String)>

Signature
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
rico.fabrini@gmail.com - 06 Nov 2007 18:10 GMT
> rico.fabr...@gmail.com wrote:
> > Hi Everyone,
[quoted text clipped - 16 lines]
> Beware of bugs in the above code; I have only proved it correct, not
> tried it. -- Donald E. Knuth
Thanks Joshua. That works and does what I was looking for.
I've got to admit that I've struggled somewhat to picture the idea of
"the entire matched string" though. So, I think of replaceAll() having
to scan the input sequence, and at every match $0 is a placeholder for
that particular match.
Without that scanning process in mind, I was baffled by the idea that
"entire matched string" meant some kind of concatenation of all the
matches.
Rico.