If you want the dot or other characters with a special meaning in regexes to be a normal character, you have to escape it with a backslash. Since regexes in Java are normal Java strings, you need to escape the backslash itself, so you need two backslashes e.g. \\.
More Related Contents:
- What do the characters ((?:(?:(?: mean in pattern-matching? [duplicate]
- Java: splitting a comma-separated string but ignoring commas in quotes
- Split string with dot as delimiter
- Use String.split() with multiple delimiters
- Getting the text that follows after the regex match
- How can I count the number of matches for a regex?
- What is the regex to extract all the emojis from a string?
- How to remove special characters from a string?
- Splitting string with pipe character (“|”) [duplicate]
- RegEx to split camelCase or TitleCase (advanced)
- Replace the last part of a string
- Java equivalent to PHP’s preg_replace_callback
- java.lang.StackOverflowError while using a RegEx to Parse big strings
- Split regex to extract Strings of contiguous characters
- Java regex – overlapping matches
- Generic support for ISO 8601 format in Java 6
- Find everything between two XML tags with RegEx
- Parsing CSV input with a RegEx in java
- simple java regex throwing illegalstateexception [duplicate]
- Range of valid character for a base 64 encoding
- Regex: ?: notation (Question mark and colon notation) [duplicate]
- Whats the difference between \z and \Z in a regular expression and when and how do I use it?
- Regex reuse a pattern to capture multiple groups?
- Regex for checking if a string is strictly alphanumeric
- Java Regex pattern that matches in any online tester but doesn’t in Eclipse
- Java Pattern Matcher: create new or reset?
- String.replaceAll is considerably slower than doing the job yourself
- Remove all occurrences of \ from string
- Extract ip addresses from Strings using regex
- Validate if input string is a number between 0-255 using regex