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.
Solved! Go to Solution.
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.
Good luck!
@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?
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!
@David-Carnes Thank you!
@atcodedog05 Thank you!
Happy to help : ) @anovohatski1