I am trying to replace a pattern as below: Original :
<a href="#idvalue">welocme</a>
Need to be replaced as :
<a href="javascript:call('idvalue')">welcome</a>
Tried the below approach:
String text = "<a href=\"#idvalue\">welocme</a>";
Pattern linkPattern = Pattern.compile("a href=\"#");
text = linkPattern.matcher(text).replaceAll("a href=\"javascript:call()\"");
But not able to add the idvalue in between. Kindly help me out. Thanks in advance.