Start Free Trial

Alteryx Designer Desktop Discussions

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

RegEx Question

anovohatski1
7 - Meteor

Hi All,

 

I am stuck, so hoping that someone can help since I am fairly new to Regex. I have two types of strings.

 

Type 1: AAA1110000000000AAA AAA             0.0000 0.0000        0.0000N      0.0000           0.0000 0.00000

 

I got the following regex string to work when using RegEx tool

([A-Z]+)111(\d+)([\w\W]+)\s+(\d+.\d+)\s+(\d+.\d+)\s+(\d+.\d+)([A-Z]+)\s+(\d+.\d+)\s+(\d+.\d+)\s+(\d+.\d+)

 

However, it fails on the second type of string, and I have no idea how to make a regex that would work on both.

 

Type 2: AAA1110000000000N/A             0.0000 0.0000        0.0000N      N/A           N/A N/A

 

Please note that I have tried to use Text to Column, but because there is no delimiter - it wouldn't work. 

4 REPLIES 4
OllieClarke
16 - Nebula
16 - Nebula

Hi @anovohatski1 if those strings are representative, then it looks like you can use whitespace as a delimiter. If you put your RegEx tool in Tokenize mode, and split to 7 columns, then the following RegEx should work:

\S+

(note that that's a capital S). This will tokenise out all non-space characters into their own column. 

 

Hope that helps,

 

Ollie

pedrodrfaria
13 - Pulsar

Hi @anovohatski1 

 

For this specific instance, this regex function would do the trick:

 

([A-Z]+)111(\d+)([\w\W]+)\s+(\d+.\d+)\s+(\d+.\d+)\s+(\d+.\d+)([A-Z]+)\s+(\d+.\d+)*\s+(\d+.\d+)*\s+(\d+.\d+)* 

pedrodrfaria_0-1612981703413.png

 

Or maybe you are looking for something like this:

 

([A-Z]+)111(\d+)([\w\W]+)\s+(\d+.\d+)\s+(\d+.\d+)\s+(\d+.\d+)([A-Z]+)\s+(\d+.\d+|N/A)\s+(\d+.\d+|N/A)\s+(\d+.\d+|N/A)

 

pedrodrfaria_1-1612981784165.png

 

Pedro.

 

anovohatski1
7 - Meteor

@OllieClarke Thank you for the suggestion. I have tried it; however, this didn't solve my problem as I want AAA AAA to be pulled together into 1 column, rather than 2. 

anovohatski1
7 - Meteor

@pedrodrfaria Thank you. The first expression worked exactly like i wanted it to.

Labels
Top Solution Authors