Use
String escapedString = java.util.regex.Pattern.quote(myString)
to automatically escape all special regex characters in a given string.
More Related Contents:
- split US phone number in java? [closed]
- how to write regex for this expression in java
- Regex for converting xml tags key to camel case
- How do i find the first un-escaped quotes in Java?
- Incrementing only the digits from an alphanumeric string
- Specific String validation using regex
- Regexp Java for password validation
- Create array of regex matches
- Split string into array of character strings
- Regex Named Groups in Java
- Using Java to find substring of a bigger string using Regular Expression
- Regex date format validation on Java
- Remove trailing zero in Java
- Extract string between two strings in java
- Is Java Regex Thread Safe?
- How to extract parameters from a given url
- Passing parameters to action through ModelDriven in Struts 2
- How to use java regex to match a line
- How to remove the backslash in string using regex in Java?
- Regex pattern including all special characters
- Java; String replace (school project)?
- Remove all non-“word characters” from a String in Java, leaving accented characters?
- java.util.regex.PatternSyntaxException: Dangling meta character ‘+’ near index 0 +
- How to match repeated patterns?
- How to escape a square bracket for Pattern compilation?
- Regex to get first number in string with other characters
- How does this Java regex detect palindromes?
- Replacing single ‘\’ with ‘\\’ in Java
- Java Counting # of occurrences of a word in a string
- Get group names in java regex