Hello, could you help me to write proper regex ?
Input: PL30210T,PL30370T-PL30045B+PL30260B+PL30220B+PL30379T
Output: PL30210T ,PL30370T -PL30045B +PL30260B +PL30220B +PL30379T
For now I use 2 RegEx tool one by another:
1. (\w+) and output method Parse output: PL30210T
2. ([+|-]\w{8}) and output method Tokenize output: -PL30045B +PL30260B +PL30220B +PL30379T
PL30210T ,PL30370T-PL30045B +PL30260B +PL30220B +PL30379T - and I don't know how to separate this bolded part.
Is it some better way to solve it ?
Solved! Go to Solution.
I'm not entirely clear what output you're looking for, but if you use this in a single RegEx tool on Tokenise you'll get all 6 codes output with any preceding symbol. You can then trim off the comma if necessary.
\W*\w{8}
I want to receive an output line this.
Col1 | Col2 | Col3 | Col4 | Col5 | Col6 |
PL30210T | ,PL30370T | -PL30045B | +PL30260B | +PL30220B | +PL30379T |
Sorry for the lack of clarification.
Hi @Wojtek_Dz,
Taking the original text string:
PL30210T,PL30370T-PL30045B+PL30260B+PL30220B+PL30379T
I'd first go down the route of adding in a delimiter to split on, in my case i've chosen to use a pipe "|". Added these into the test string using a Regex_Replace() function:
REGEX_Replace([Text], "(\W)", "|$1")
This edited the text string to add the pipe delimiters in place:
PL30210T|,PL30370T|-PL30045B|+PL30260B|+PL30220B|+PL30379T
Allowing us to now split the string with a text to columns tool:
I've attached my workflow for you to download if needed!
Kind regards,
Jonathan
Thanks @Sebastiaandb and @Jonathan-Sherman for quick answer. Both of those are great but the solution of @Jonathan-Sherman is more user friendly.
@Wojtek_Dz @Jonathan-Sherman haha it is (arghhhh ;-))!
@Wojtek_Dz If you switch my RegEx version to tokenise to columns instead of rows you'll get your output from a single tool. Just increase the number of columns to accommodate your data.