Monday 20 May 2019

java.util.regex.Matcher.appendReplacement(Matcher.java:857) : IllegalArgumentException

threw exception
java.lang.IllegalArgumentException: Illegal group reference
    at java.util.regex.Matcher.appendReplacement(Matcher.java:857)
    at com.famposo.web.lib.HTML5TemplateEnigne.parse(HTML5TemplateEnigne.java:200)
    at com.famposo.web.view.Page.index(Page.java:36)
 
Solution: 
 
 
 matcher.appendReplacement(sb, text);
 
replace with 
  
m.appendReplacement(sb, Matcher.quoteReplacement(text));
 
it works 
 
i found this ref here 
 
 https://www.javamex.com/tutorials/regular_expressions/search_replace_loop.shtml

No comments:

Post a Comment