Alteryx Designer Desktop Discussions

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

RegEx and Parsing Question

Rosaile
7 - Meteor

Hello,

 

I'm brand new to Alteryx, and pretty new at analyzing/manipulating data.

 

I'm trying my hand at using RegEx to parse some county jurisdictions.  My challenge is some of my data has just one word, some two, and some have three, etc.  I tried to make a regex expression to capture all the scenarios, but jurisdictions that are just one word are still returning false and populating null.  My example is below.  Could anyone assist with where my expression is failing?

 

Here is what I came up with so far, using RegEx

((?:^\w+)|(?:^.*)|(?:\<\w+\>))\s(\w+)

 

Results   
    
JurisdictionRegEX 1 RegEx 2 
Anchoragenullnullnot ok
Los AngelesLosAngeles ok
St. Lucie CountySt. LucieCountyok

 

 

Thanks!

 

 

2 REPLIES 2
mceleavey
17 - Castor
17 - Castor

Hi @Rosaile,

 

when using the "|" in regex it effectively creates a marked group (or...) and so I simply created another which will kick in it it fails to meet the criteria of the other.

I set up the regex parser as such:

 

solution for Rosalie.PNG

 

Which gives you the following:

 

results for rosalie.PNG

 

which you can then manipulate accordingly.

 

Hope this helps.

 

M.

 



Bulien

Rosaile
7 - Meteor

Thank you!  That is exactly what I wanted.

Labels