Filter Paren's out. ie. (any text here including the parens)

Filter Paren’s out including the enclosed text. ie. (any text here including the parens)

If the variable is
300 Mamaroneck Ave (Ent in Back - Apt 318 - Key at Desk)
I’d like to end up with
300 Mamaroneck Ave

I attempted a couple searches that gave me regex suggestions, to no avail.

Try this RegEx in a KM Search and Replace Variable action (KM Wiki)
[ \t]*\(.+\)

This also removes any number of spaces and tabs before the parens.

1 Like

Works great.
Also really appreciate the explanation, trying to get a little RegEx under my belt,.... if possible. thanx.

Glad to hear it. And you will greatly benefit.
The key is to just keep tying, every day, every opportunity.
We are always glad to help, but the best way to learn is by trial and error.

###Best Resources to Learn RegEx

  • Regular-Expressions.info -- great tutorials
  • Regex101.com -- great tool for editing, testing, getting explanation of, RegEx.
    • I don't post any RegEx solutions without first testing them here
1 Like

Rather than .+, you probably want either

.+?

or

[^)]+

Otherwise, if you have a sentence like:

This (really) or that (not so much) will work.

You will eat everything in the middle and get just "This will work." (which, ironically, it didn't).

2 Likes