Free Trial

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Using Regex with a field value

bb213
8 - Asteroid

I am trying to parse dirty data.  I have a list of names that I am feeding into Find/Replace. For instance, one of the names I'm trying to find is JOHN79.

 

String: JOHN 79NGSB -> FIND AND REPLACE TOOL -->  Output: JOHN 79 

 

The problem is that I need "JOHN 79" to be surrounded by spaces, (i.e., not touching anything else), so in the above example, I want nothing to be returned as output. Is there a way I could use Regex to take the Find/Replace Output and use that value to check if it has spaces on either side?  If it starts at the beginning of a line or ends the line, that is ok too. 

 

For example, the following are ok: 


JOHN 79 NGSB

23983324 JOHN 79 

 

Not Ok: 

 

JOHN 79213

123JOHN 79

 

Any help would be appreciated. 

 

 

 

2 REPLIES 2
NicoleJohnson
ACE Emeritus
ACE Emeritus

In the Find & Replace tool, try checking the box for "Match Whole Word Only". I believe this will eliminate the ones that have letters/numbers adjoining the names you're trying to find.\

 

Capture.PNG

 

Hope that helps!

 

Cheers,

NJ

jrgo
14 - Magnetar

Hi @bb213,

 

Below is the expression I added to a RegEx tool using the Parse output method. Can use the Replace, but added to a new field for output comparison.

(?:^|\s)(JOHN 79)(?:\s|$)

2017-10-26_11-47-26.jpg

 

Attached is the workflow as well. Hope this helps!

 

Best,

 

Jimmy

Labels
Top Solution Authors