This site uses different types of cookies, including analytics and functional cookies (its own and from other sites). To change your cookie settings or find out more, click here. If you continue browsing our website, you accept these cookies.
Alteryx Gallery is experiencing a problem in which system emails are not being sent out. As a result, if you are attempting to sign up for a new account, you may be unable to verify your email address. We are working to solve this as soon as possible and will remove this notice once resolved.
I got a bunch text with characters and words I want to clean up , I have come up with a Regex_Replace formula, it seems to only do part of what I want ( it doesn't remove anything after specific word) ...could someone help trouble shoot this formula? Thanks
find below item and replace with blanks:
1. remove all after period (.)
2. remove all after semicolon (:)
3 remove all after certain word (Respect) or (Behalf)
(^.*?) - ^ beginning of the sentence, .*? any character 0 or more times until it finds the next character in our expression (that's why we put the "?" character). We put between parenthesis for further reference in the replacement expression.
[\.:] - this means a dot "." or a semicolon ":". The dot is escaped (\) because it's a metacharacter.
| - this is an alternation character
respect and behalf are the exact words you're looking for
([\.:]|respect|behalf) - this whole expression means you can find either a dot, a semicolon, "respect" or "behalf". And it's between parenthesis because we need to reference that in our replacement expression.
.* - any character 0 or more times. This basically means anything after what we specified in our previous expression.
The replacement expression:
It's basically the first expression in parenthesis ($1) followed by the second ($2). So we get rid of everything we didn't reference and put between parenthesis.