Reputation: 9827
Is there a way in regex to match all kinds of quotes? I'm matching the '
character but is there a way to change the below regex pattern to also match ```
and `
?
final Pattern QUOTE_PATTERN = Pattern.compile("'''.*?'''|'.*?'", Pattern.DOTALL);
final Matcher quoteMatcher = ContentCommonConstants.QUOTE_PATTERN.matcher(value);
Upvotes: 3
Views: 260
Reputation: 19423
Why can't you do something like this:
'''.*?'''|'.*?'|```.*?```|\\u2018.*?\\u2019
NOTICE: \u2018
is the Unicode code point of the single left quote ‘
.
\u2019
is the Unicode code point of the single right quote ’
.
Upvotes: 2