Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix incorrect regex on Person.name field (#1089)
The example regular expression introduced in 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. --------- Co-authored-by: Chris Roche <github@rodaine.com>
- Loading branch information