For some reason this regex keeps saying it is invalid in java, but on the online testers it works fine:
({.+?})
I am using it for a JSON data structure.
Is there a way to get it to work with Java?
Included link: http://regexr.com/3bs0p
For some reason this regex keeps saying it is invalid in java, but on the online testers it works fine:
({.+?})
I am using it for a JSON data structure.
Is there a way to get it to work with Java?
Included link: http://regexr.com/3bs0p
 
    
    You probably need to escape your { } with backslashes, since you are treating them as literal characters.
E.g.
(\\{.+?\\})
 
    
    Here are my 2 cents:
{ in Java regex to tell the engine it is not the brace starting the limiting quantifier. .group(0) or $0 back-reference.The regex should look like
String pattern = "\\{.+?}"; // Note that `.+?` requires at least 1 character,
                            // Use .*? to allow 0 characters
And
 
    
    