-
Notifications
You must be signed in to change notification settings - Fork 151
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
Dropped support for named group captures with underscore #108
Comments
Here a diff you can apply which tests the missing underscore support:
|
The fact that this broke _ support was known at the time of the change and referenced in #53, so this was on purpose and accepted as far as I can tell. I don't think you have to convince anyone this is an issue. What you would have to convince people of is that the original PR ( 2016?) was not worth dropping this support. |
For us in Graylog it is simply the fact that we have users with Grok Patterns which do contain named groups with underscores. And dropping the support means a lot of work for the users, manually rewriting there Grok Patterns. |
So, from what I can tell that support was lost because the library that provides it is for java 5/6, so it just can't be 'added back'. Maybe you can submit a PR? But there might be other reasons..... |
I would have a PR ready when you want. But as I read in #53 performance with |
So we really need @anthonycorbacho to comment. I was not involved at that time, and I am not a committer now, although I have submitted a couple of PR etc. Switching the regex engine, as I believe this change did was and is a big deal, and as I said they knew they were making this breaking change and accepted it. I don't think there is any going back. I would imagine if you wrote something that say did mapping between _ and some allowable character on the fly ( so that the caller can use _ but inside it is replaced ) that would be the way to go. But @anthonycorbacho leads the project. |
With #53 we lost the ability to have named group captures with underscore like
(?<test_field>test)
.java-grok
had the support as long as we used thecom.google.code.regexp.Pattern
.Now with
java.util.regex.Pattern
we use the java regex engine which does not support underscores:https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html#groupname
This broke backward compatibility with already stored patterns.
Preferable fix was to bring back
com.google.code.regexp.Pattern
.The text was updated successfully, but these errors were encountered: