You are viewing limited content. For full access, please sign in.

Question

Question

Remove Word using Regular Expression

asked on October 6, 2016

Hi,

Using regular Expression i am trying to remove one word "Other" from any string.

e.g

Other Account -> Account

Offshore Account -> Offshore Account

When i try this

[^Other].*

it solves my problem but it creates a bigger problem

Offshore Account -> ffshore Account

this regular expression doesn't look for Word Other, instead it looks for characters and then removes them. 

It would be ideal if i could remove word "Other" both in the front or at the back of the string. It should be removed anywhere in the string. 

This solves my problem temporarily but i would like to use regular expression instead.

Thanks

Junaid Inam

0 0

Answer

SELECTED ANSWER
replied on October 7, 2016

It's not possible to do it with a single regular expression. The one above will work for the case where the word "other" is present. You can run the token generated through a Conditional Sequence and if blank, then set it back to the original value since that would indicate the word "other" was not present.

0 0

Replies

replied on October 6, 2016

Kevin's solution in the thread you linked is using regular expressions. Is that not working for you?

0 0
replied on October 6, 2016

No. For Kevin solution to work, string has to have "other" word included, if its not there then it rejects the entire string.

Other Account -> Account (Working)

Offshore Account -> Offshore Account (Not Working)

0 0
replied on October 7, 2016

Not sure if this is what you are looking for. But from my understanding if the words are "other account" you only want to see "account" if the words are "Offshore account" you want to see "Offshore account". If that is the case, the following worked for me    (.*)other(.*) This allowed words before and after the word "other" to be seen.

0 0
replied on October 7, 2016

Thanks for your reply this works for other account but Offshore Account is not working for me.

0 0
replied on October 11, 2016 Show version history

How about using this one (Offshore)?(\s)(Account)

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.