java - Why replaceAll("*.<td>","<tr><td>Myval"); got error? -


i got string s="<tr><td>myval";

i want replace strings before "<td>" & include "<td>" "";

 s=replaceall("*.<td>",s); 

so result should s="myval" got runtime error.

   12:39:31.035 [error]  uncaught exception escaped java.util.regex.patternsyntaxexception: dangling meta character '*' near index 0  *.<td>  

how fix?

in regular expressions, * quantifies expression coming before it. here, you've put * @ beginning of pattern, meaningless.

maybe wanted ".*<td>".


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -