Java Regex matching between curly braces

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…

Leave a Comment