Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support full regular expression on PatterMatcher.match() #4492

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for full regular expressions in PatternMatchingCompositeLineMapper
2 participants