1

When I improve my code with Lint, there is inspection error with a duplicate character inside regular expression

private static final String IMAGE_LINK_PATTERN = "[(.*)![(.*)]((.*))(.*)](.*)";
private static final String IMAGE_LINK_REPLACE = "<a href=\"$5\" >$1<img src=\"$3\" />$4</a>";

Duplicate character '(' inside character class
Duplicate character '.' inside character class
Duplicate character '*' inside character class
Duplicate character ')' inside character class
Duplicate character '(' inside character class
Duplicate character ')' inside character class

these is no problem with the regular pattern, so how to suppress this lint error?

Alen Lee
  • 2,479
  • 2
  • 21
  • 30
  • 1
    If the character was accidentally duplicated, remove it. If the character class was meant to be a group, replace the brackets with parentheses. – Vikas Suryawanshi Dec 27 '17 at 10:12
  • Finally, I extract the string into String Resource, it skips the lint – Alen Lee Dec 28 '17 at 03:26
  • Skipping the lint is a non-sense, you should fix the bug you were warned about. Your `IMAGE_LINK_PATTERN` seems to be completely broken. – maaartinus Dec 29 '17 at 16:59

0 Answers0