-
Notifications
You must be signed in to change notification settings - Fork 585
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
Fix incorrect regex on Person.name field #1089
Conversation
The example regular expression introduced in bufbuild@10eb9db does not seem to work as intended, due to nesting a negated range inside another range: ``` ❯ jshell --class-path ~/.m2/repository/com/google/re2j/re2j/1.7/re2j-1.7.jar | Welcome to JShell -- Version 17.0.9 | For an introduction type: /help intro jshell> com.google.re2j.Pattern p = com.google.re2j.Pattern.compile("^[^[0-9]A-Za-z]+( [^[0-9]A-Za-z]+)*$"); p ==> ^[^[0-9]A-Za-z]+( [^[0-9]A-Za-z]+)*$ jshell> p.matches(pattern, "Protocol Buffers"); $4 ==> false jshell> p.matches(pattern, "Matt Brown"); $5 ==> false ``` The nesting of ranges in the example is also redundant - if you are going to specify that only `[A-Za-z]` is valid than including [^0-9]` in that range is not necessary. This commit fixes the example regular expression to match the example "name" mentioned later in the README.
Hey, @mattnworb, and thanks for the patch! Hm, looks like at some point it was made inconsistent with the regex that was originally in the readme: |
noticed an occurrence of the regex used in |
Looks good! Once you sign the CLA we can get this merged 😁 |
done, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again! 😁
The example regular expression introduced in 10eb9db does not seem to work as intended, due to nesting a negated range inside another range:
The nesting of ranges in the example is also redundant - if you are going to specify that only
[A-Za-z]
is valid than including [^0-9]` in that range is not necessary.This commit fixes the example regular expression to match the example "name" mentioned later in the README.