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

hibernate - How to load global settings frequently used in application in Java -

python 3.x - Mapping specific letters onto a list of words -

objective c - Ownership modifiers with manual reference counting -