Start a new topic

RegEx to replace with blank fields starting with certain characters

Hi all,

 

I've been looking through the forums for a solution but I can't find anything that really matches this scenario that I understand enough to be able to modify.

 

I need to create a dictionary which will replace data with BLANK for fields where the data begins with 08/+618/02/+612/07/+612/03/+613 and keep the value if the data begins with 04/+614

Then I need to have a dictionary that does the exact opposite - replaces with BLANK for 04/+614 and keeps the data for the rest.

 

Would anyone be able to help?


Hello Debbie, sorry to take so long to get back to you.

I misunderstood the question from the beginning!

Now I see that you want to replace anything that starts with 04 or starts with +614.  I had understood that it would start with "04/+614"

Anyways, the solution is this:

^04.*

^\+614.*

Same idea with the others.  The issue was that + is a protected symbol in regular expressions so you have to "escape" it with a leading \ in order for the regular expression engine to interpret it as a literal character instead of the function +.

Hi Wayne,

I've used that code and I think it's having an issue with the + symbol.

I've put in ^04/\+614.* and when testing nothing was replaced with blank, same value copied over.

Using just ^04.*, any beginning with 04 replaced with blank - perfect!
Tested ^+614.* and the value of +614 replaces with +614

The data starts with those strings - starting with 08 may look like 0812345678 or 08 1234 5678, etc.
Can you give some examples of what the incoming data looks like? Does it just start with some of those characters or is that the whole field?

You can get a blank replacement value by just clicking the + sign on the empty Replacement Value box.

Assuming the field has more to it than the starting values it would look like

^08/\+618.*
^02/\+612.*
etc.

You don't need to do anything for values you want to leave alone

The second dictionary is the same but will only have one entry.





Login or Signup to post a comment