Java Regex for matching quoted string with escaped quotes
Posted
by kayahr
on Stack Overflow
See other posts from Stack Overflow
or by kayahr
Published on 2010-03-23T09:15:37Z
Indexed on
2010/03/23
9:23 UTC
Read the original article
Hit count: 337
I know there are already many questions like mine but I found no answer which works in Java. So I write a new question.
I have text files with content like this:
key1 = "This is a \"test\" text with escapes using '\\' characters"; key2 = 'It must work with \'single\' quotes and "double" quotes';
I need a regular expression which matches the values in the double-quotes (or single-quotes). This regular expression must support the escaped quotes and escaped backslashes. The regular expression must work with Java standard Pattern/Matcher classes.
© Stack Overflow or respective owner