you need to escape ‘{‘ & ‘}’ with a ‘\’
so: "{(.*?)}"
becomes: "\\{(.*?)\\}"
where you have to escape the ‘\’ with another ‘\’ first
see: http://www.regular-expressions.info/reference.html for a comprehensive list of characters that need escaping…
More Related Contents:
- Find the highest number between two literal strings using a Regular Expression
- How to parse a string that contains value only needed partially to an arraylist? [closed]
- How to split a string, but also keep the delimiters?
- Match multiline text using regular expression
- Regex to match a C-style multiline comment
- Regex for matching something if it is not preceded by something else
- Splitting a string at every n-th character
- Parsing XML with REGEX in Java
- Java – Best way to grab ALL Strings between two Strings? (regex?)
- removing invalid XML characters from a string in java
- Replacing all non-alphanumeric characters with empty strings
- Extracting pairs of words using String.split()
- Java String.split() Regex
- Java – regular expression finding comments in code
- Remove all empty lines
- Given a string, generate a regex that can parse *similar* strings
- Regular Expression to match 3 or more Consecutive Sequential Characters and Consecutive Identical Characters
- How to split a comma separated String while ignoring escaped commas?
- PatternSyntaxException: Illegal Repetition when using regex in Java
- java regex capture group
- How to remove HTML tag in Java [duplicate]
- Split string into sentences
- What is the equivalent of Regex-replace-with-function-evaluation in Java 7?
- Regex split numbers and letter groups without spaces
- Why does replaceAll fail with “illegal group reference”?
- How to create a regex for accepting only alphanumeric characters? [duplicate]
- Regex to get first number in string with other characters
- How does this Java regex detect palindromes?
- Replacing single ‘\’ with ‘\\’ in Java
- Get group names in java regex