i tried to implement a Regexp function to catch URLs from the Chat Message in ChatService.java but i get only this result.
How can this be done ?
the DWR framework is confusing me

Moderator: moderators
ytechie wrote:Can you share the regexp mod? I would love to learn something new!
private String ReplaceUrl(String message) {
Pattern patt = Pattern.compile("(?<!\\S)(((f|ht){1}tp[s]?:\\/\\/|(?<!\\S)www\\.)[-a-zA-Z0-9@:%_\\+.~#?&\\/\\/=]+)");
Matcher matcher = patt.matcher(message);
if(matcher.find()){
if (matcher.group(1).startsWith("http://")){
return matcher.replaceAll("<a href=\"$1\" target=_blank>$1</a>");
}else{
return matcher.replaceAll("<a href=\"http://$1\" target=_blank>$1</a>");
}
}else{
return message;
}
}
dwr.util.setEscapeHtml(false);
dwr.util.setValue('x', "<b>Hi</b>", { escapeHtml:false });
Return to Mods, Apps and Clients
Users browsing this forum: No registered users and 1 guest