I'm working on a script that gets some data fed into it. Some of the fields
have two names, one wrapped in (). Example: "Jessica (Yvonne)". I am trying to
remove everything within the (), but I'm not sure how. I've tried several regex
expressions, and I'm able to remove the (), but not the content within them.
Essentially I'd like to turn "Jessica (Yvonne)" into "Jessica" (even if there
is whitespace after 'Jessica').
I tried several suggestions I saw online, escaping the "(" and ")", or using
$regex = [regex]::Escape('()'), but I'm not sure how to basically say "Find '('
and remove everything until ')' [including the parenthesis].
Any helpful tips or links where people are doing this? I tried doing array
matches, removing the () and then selecting only the first position, but then
discovered some of the fields have the parenthesis first (e.g. "(Yvonne)
Jessica".
Thanks for any suggestions.
Confidentiality Notice: This is a transmission from Community Hospital of the
Monterey Peninsula. This message and any attached documents may be confidential
and contain information protected by state and federal medical privacy
statutes. They are intended only for the use of the addressee. If you are not
the intended recipient, any disclosure, copying, or distribution of this
information is strictly prohibited. If you received this transmission in error,
please accept our apologies and notify the sender. Thank you.