[PATCH] Match last names with an "O'" prefix (like "Foo O'Bar").
Asher Gordon <[email protected]> Sun, 2 Mar 2025 00:37:36 -0500
| Newsgroups | gmane.emacs.bbdb.user |
|---|---|
| Message-ID | <[email protected]> |
We can't simply add "O'" to bbdb-lastname-prefixes, because of the "\\>" in the regexp. This also allows names like "Foo Bar-O'Baz", "Foo O'Bar-Baz-Why-O'Why-Did-You-Name-Me-This", etc. It even allows things like "Foo von O'Bar", though I imagine that would be quite uncommon. --- lisp/bbdb.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/bbdb.el b/lisp/bbdb.el index 8ad557e..81f4dd0 100644 --- a/lisp/bbdb.el +++ b/lisp/bbdb.el @@ -622,10 +622,11 @@ Case is ignored." :type '(repeat string)) (defcustom bbdb-lastname-re - (concat "[- \t]*\\(\\(?:\\<" - (regexp-opt bbdb-lastname-prefixes) - ;; multiple last names concatenated by `-' - "\\>[- \t]+\\)?\\(?:\\w+[ \t]*-[ \t]*\\)*\\w+\\)\\'") + (let ((name-re "\\(?:O'\\)?\\w+")) + (concat "[- \t]*\\(\\(?:\\<" + (regexp-opt bbdb-lastname-prefixes) + ;; multiple last names concatenated by `-' + "\\>[- \t]+\\)?\\(?:" name-re "[ \t]*-[ \t]*\\)*" name-re "\\)\\'")) "Regexp matching the last name of a full name. Its first parenthetical subexpression becomes the last name." :group 'bbdb-record-edit -- 2.47.2