salutations: ignores case.
Project: http://git-wip-us.apache.org/repos/asf/commons-text/repo Commit: http://git-wip-us.apache.org/repos/asf/commons-text/commit/4bb5dddf Tree: http://git-wip-us.apache.org/repos/asf/commons-text/tree/4bb5dddf Diff: http://git-wip-us.apache.org/repos/asf/commons-text/diff/4bb5dddf Branch: refs/heads/pr/4 Commit: 4bb5dddf5001745e890b4fcd7bd77404e462d7c7 Parents: 1c64033 Author: Tom MacKenzie <tom.s.macken...@gmail.com> Authored: Mon Jun 20 11:21:48 2016 -0500 Committer: Tom MacKenzie <tom.s.macken...@gmail.com> Committed: Mon Jun 20 11:21:48 2016 -0500 ---------------------------------------------------------------------- .../java/org/apache/commons/text/names/HumanNameParser.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/commons-text/blob/4bb5dddf/src/main/java/org/apache/commons/text/names/HumanNameParser.java ---------------------------------------------------------------------- diff --git a/src/main/java/org/apache/commons/text/names/HumanNameParser.java b/src/main/java/org/apache/commons/text/names/HumanNameParser.java index 6780194..84fe12a 100644 --- a/src/main/java/org/apache/commons/text/names/HumanNameParser.java +++ b/src/main/java/org/apache/commons/text/names/HumanNameParser.java @@ -110,8 +110,8 @@ public final class HumanNameParser { public HumanNameParser() { // TODO make this configurable this.salutations = Arrays.asList( - "Mr", "Mrs", "Ms", "Miss", "Dr", - "Mr.", "Mrs.", "Ms.", "Miss.", "Dr." + "mr", "mrs", "ms", "miss", "dr", + "mr.", "mrs.", "ms.", "miss.", "dr." ); this.suffixes = Arrays.asList( "esq", "esquire", "jr", @@ -144,7 +144,7 @@ public final class HumanNameParser { // but you can select a particular parenthesized submatch to be returned. // Also, note that each regex requres that the preceding ones have been run, and matches chopped out. // names that starts or end w/ an apostrophe break this - String salutationRegex = "^(("+salutations+"))"; + String salutationRegex = "^(?i)(("+salutations+"))"; String nicknamesRegex = "(?i) ('|\\\"|\\(\\\"*'*)(.+?)('|\\\"|\\\"*'*\\)) "; String suffixRegex = "(?i),* *((" + suffixes + ")$)"; String lastRegex = "(?i)(?!^)\\b([^ ]+ y |" + prefixes + ")*[^ ]+$";