Skip to content

Commit

Permalink
Merge pull request #2 from Ecwid/unicode
Browse files Browse the repository at this point in the history
- added unicode support
  • Loading branch information
filka96 authored Jul 1, 2024
2 parents 833e361 + ed633c8 commit cc541e2
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,11 @@ private void parse() throws ParseException {
// The regex use is a bit tricky. *Everything* matched by the regex will be replaced,
// 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.
String nicknamesRegex = "(?i) ('|\\\"|\\(\\\"*'*)(.+?)('|\\\"|\\\"*'*\\)) "; // names that starts or end w/ an apostrophe break this
String suffixRegex = "(?i),* *(("+suffixes+")$)";
String lastRegex = "(?i)(?!^)\\b([^ ]+ y |"+prefixes+")*[^ ]+$";
String leadingInitRegex = "(?i)(^(.\\.*)(?= \\p{L}{2}))"; // note the lookahead, which isn't returned or replaced
String firstRegex = "(?i)^([^ ]+)";
String nicknamesRegex = "(?U)(?i) ('|\\\"|\\(\\\"*'*)(.+?)('|\\\"|\\\"*'*\\)) "; // names that starts or end w/ an apostrophe break this
String suffixRegex = "(?U)(?i),* *(("+suffixes+")$)";
String lastRegex = "(?U)(?i)(?!^)\\b([^ ]+ y |"+prefixes+")*[^ ]+$";
String leadingInitRegex = "(?U)(?i)(^(.\\.*)(?= \\p{L}{2}))"; // note the lookahead, which isn't returned or replaced
String firstRegex = "(?U)(?i)^([^ ]+)";

// get nickname, if there is one
this.nicknames = this.name.chopWithRegex(nicknamesRegex, 2);
Expand Down

0 comments on commit cc541e2

Please sign in to comment.