Skip to content
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

stringx.ExtractNames: Accept semicolons #389

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion internal/stringx/stringutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func RemoveAllWhitespace(s string) string {

var (
staffRe = lazy.RE(`(?i)\bstaff\b`)
extractSplitRe = lazy.RE(`(?i),|\band\b`)
extractSplitRe = lazy.RE(`(?i)[,;]|\band\b`)
outletRe = lazy.RE(`(?i)\b(of|for)\b.*$`)
)

Expand Down
1 change: 1 addition & 0 deletions internal/stringx/stringutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ func TestExtractName(t *testing.T) {
[]string{"Carter Walker", "Laura Benshoff"},
},
{"Wyatt Massey of Spotlight PA State College", []string{"Wyatt Massey"}},
{"Danielle Ohl of Spotlight PA; Jessica Lussenhop of ProPublica; and Irina Bucur, Tracy Leturgey and Eddie Trizzino of The Butler Eagle", []string{"Danielle Ohl", "Jessica Lussenhop", "Irina Bucur", "Tracy Leturgey", "Eddie Trizzino"}},
}
for _, tc := range cases {
be.AllEqual(rt, tc.Want, stringx.ExtractNames(tc.Input))
Expand Down
Loading