Posted By

BenClayton on 03/02/11


Versions (?)

Android: Search and replace in a string with a quoted regex..

 / Published in: Java

Sometimes you don't want to use a regex in a String.replace method. You need to 'quote' the special regex characters with Pattern.quote("string")

  1. indexString.replaceAll(Pattern.quote(notARegex), replacement );

Report this snippet  

You need to login to post a comment.