Return to Snippet

Revision: 42295
at March 2, 2011 23:07 by BenClayton


Initial Code
indexString.replaceAll(Pattern.quote(notARegex), replacement );

Initial URL

                                

Initial Description
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")

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

Initial Tags

                                

Initial Language
Java