community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

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

RegEx and Parsing Question

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!

 

 

Highlighted
Alteryx Certified Partner

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.

 

Meteor

Thank you!  That is exactly what I wanted.

Labels