Skip to content

Conversation

@injae-kim
Copy link
Contributor

related issue #4412

Motivation:

Modification:

  • Support full regular expression on PatterMatcher.match() that used on PatternMatchingCompositeLineMapper.mapLine()

Result:

Comment on lines +226 to +235
if (value == null) {
for (String key : sorted) {
try {
if (matchRegex(key, line)) {
value = map.get(key);
break;
}
} catch (Throwable ignored) {}
}
}
Copy link
Contributor Author

@injae-kim injae-kim Nov 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can replace match() to matchRegex(), but I think it makes breaking change.

  • e.g. "*" means matching all lines on match(), but invalid regex format and throws PatternSyntaxException on matchRegex()
  • "abcde" matches "abc*" on match(), but not matches on matchRegex() ("abc*" matches only "abccc.." on regex)

(also PatternMatcherTests failed if we replace match() to matchRegex())

To avoid this breaking change, I intentionally matchRegex() only when there's nothing matched by match()~!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment