Hi
I have following data set, I would like to Add |0 After the text, whenever there is only 3 delimiters
For ex: from SLno: 2 to 5 , as show below I have 4 delimiters , which can be separated into 4 columns but
from slno" 7, I have only 3 delimiters , whenever there is 3 delimiters i would like to add |0
ex: slno: TOTAL ACQR|0|185|590.00|199,67CR
SLNO | DATA |
1 | INTR VALUE |
2 | TOTAL ACQR|134|145|55.00|134,67CR |
3 | TOTAL ISS|0|0.00|0.00|0 |
4 | TOTAL OTHER|0.00|0|0.00|0 |
5 | TOTAL INTR VALUE|134|145|55.00|134,67CR |
6 | FEES |
7 | TOTAL ACQR|185|590.00|199,67CR |
8 | TOTAL ISS|0.00|0.00|0 |
9 | TOTAL OTHER|0|0.00|0 |
10 | TOTAL FEES|185|590.00|199,67CR |
11 | INTR VALUE |
12 | TOTAL ACQR|177|55.00|134,67DB |
13 | TOTAL ISS|0.00|0.00|0 |
14 | TOTAL OTHER|0.00|0|0.00 |
15 | TOTAL INTR VALUE|177|55.00|134,67DB |
16 | FEES |
17 | TOTAL ACQR|185|590.00|199,67CR |
18 | TOTAL ISS|0.00|0.00|0 |
19 | TOTAL OTHER|0|0.00|0 |
20 | TOTAL FEES|185|590.00|199,67CR |
Expected output : (from 6 to 10 shown as example)
FEES | ||||
TOTAL ACQR | 0 | 185 | 590 | 199,67CR |
TOTAL ISS | 0 | 0 | 0 | 0 |
TOTAL OTHER | 0 | 0 | 0 | 0 |
TOTAL FEES | 0 | 185 | 590 | 199,67CR |
Solved! Go to Solution.
Thank you
in my real data set I have additional rows also
if I use the given regex, it giving COUNT|0|CREDIT|DEBIT|TOTAL, where there is Count
DATA |
COUNT|CREDIT|DEBIT|TOTAL |
AMOUNT|AMOUNT|AMOUNT |
COUNT|CREDIT|DEBIT|TOTAL |
AMOUNT|AMOUNT|AMOUNT |
INTR VALUE |
TOTAL ACQR|134|145|55.00|134,67CR |
TOTAL ISS|0|0.00|0.00|0 |
TOTAL OTHER|0.00|0|0.00|0 |
TOTAL INTR VALUE|134|145|55.00|134,67CR |
FEES |
TOTAL ACQR|185|590.00|199,67CR |
TOTAL ISS|0.00|0.00|0 |
TOTAL OTHER|0|0.00|0 |
TOTAL FEES|185|590.00|199,67CR |
COUNT|CREDIT|DEBIT|TOTAL |
AMOUNT|AMOUNT|AMOUNT |
INTR VALUE |
TOTAL ACQR|177|55.00|134,67DB |
TOTAL ISS|0.00|0.00|0 |
TOTAL OTHER|0.00|0|0.00 |
TOTAL INTR VALUE|177|55.00|134,67DB |
FEES |
TOTAL ACQR|185|590.00|199,67CR |
TOTAL ISS|0.00|0.00|0 |
TOTAL OTHER|0|0.00|0 |
TOTAL FEES|185|590.00|199,67CR |
@BRRLL99 The above regex works based on the count of the delimiter '|', because the count row has 3 delimiters it adds the |0 to the count row as well
try
IIF(REGEX_CountMatches([DATA], '\|') = 3 AND REGEX_CountMatches([DATA], '\d') !=0,REGEX_Replace([DATA], "(.*?)\|.*", '$1')+'|0|'+REGEX_Replace([DATA], "(.*?)\|(.*)", '$2'),[DATA])