Alteryx Designer Desktop Discussions

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

REGEX to split String of TEXT

anovohatski1
7 - Meteor

Good morning,

 

I am fairly new to RegEx so hoping that someone could help me out. I am looking for a way to split out two types of text string, but failing. Any suggestions or ideas are highly appreciated. 

 

String Type 1

NUMBER #: 1234567890 ABC OF ABC (could be anything)    TYPE: 99 ABC

Current attempt at REGEX (output method parse): .:*(\d+) which only gives me 1234567890 and nothing else

 

String Type 2

ABC1 1,111,111.11      11.11       0.00

Current attempt at REGEX (output method parse): (\d+)([^\d]([^\s]+).*?(\d*\.\d*) which gives me the following output. Any suggestions on how to make this expression better?

 

RegEx Output 1: 1

RegEx Output 2: 

RegEx Output 3: 1,111,111.11

RegEx Output 4: 11.11

 

Once again any help with this is highly appreciated.

7 REPLIES 7
David-Carnes
12 - Quasar

@anovohatski1 

Please see the attached workflow.

 

String 1:  (\d+)\s+([\w\W]+)

String 2 could be sent though the Text to Columns.  If you don't know until runtime how many columns you need, you could wrap the Text to Columns in a Batch Macro and use the Control Parameter to set the number of columns.

 

David-Carnes_0-1601043280164.png

 

 

Good luck!

 

anovohatski1
7 - Meteor

@David-Carnes Thank you for sending the solutions. I should have been more clear. I am looking to break string 1 into 4 parts, rather than 2:

 

Part 1 1234567890

Part 2 ABC OF ABC 

Part 3 99

Part 4 ABC

 

Is there any way to tweak the code that you already sent to be able to accomplish this?

David-Carnes
12 - Quasar

@anovohatski1 

Sorry I misunderstood your intent.
Use this to parse the string into four columns:

 

 

NUMBER\s\#\:\s+(\d+)\s+([\w\W]+)\s+TYPE\:\s+(\d+)\s+(\w+)

 

 

 

The second output, ABC OF ABC, will have trailing spaces, so be sure to clean that up.

 

Good luck and have fun!

 

atcodedog05
22 - Nova
22 - Nova

Hi @anovohatski1 ,

 

Here is the workflow for the task

atcodedog05_1-1601052346658.png

Output

 

atcodedog05_0-1601052330796.png

Hope this helps : )

anovohatski1
7 - Meteor

@David-Carnes Thank you!

anovohatski1
7 - Meteor

@atcodedog05 Thank you!

atcodedog05
22 - Nova
22 - Nova

Happy to help : ) @anovohatski1

Labels