Thanks. I'd been wondering if there were a way to check the end of line. Knowing that $ should come in handy. And I should have thought of the \2 \1 replacement.
Regarding the "full" search:
^(.+),\s(the|a|an)$
I'd wondered about matching "a" before "an". Is the regex parsed left-to-right within the parentheses? If it is, it might catch a trailing
", an"
as
", a"
and leave an "n" hanging off the end of the title. Perhaps just changing the order to:
^(.+),\s(the|an|a)$
would do it.
EDIT: Oops. Nope. That's what the "anchor to the end" "$" is for. With that, "a" won't match "an" since it's not the last string. Sorry.
Last edited by enuddleyarbl; 06-18-2021 at 12:28 PM.
|