Situation
I was performing a replace of some data when I came across a peculiarity.
|C405|01102015|7|1058|174544|19836903,14|18657,06|
|C405|02102015|2|1059|174792|19859872,19|22441,55|
|C405|03102015|3|1060|174953|19872892,09|12993,90|
|C405|05102015|5|1061|175186|19893103,21|20126,12|
|C405|06102015|3|1062|175409|19914579,78|20500,57|
|C405|07102015|7|1063|175616|19937968,35|23388,57|
|C405|08102015|2|1064|175800|19954350,96|16382,61|
|C405|09102015|1|1065|176034|19975441,21|20483,75|
|C405|10102015|7|1066|176189|19987132,54|11570,33|
|C405|13102015|2|1067|176422|20010561,52|23052,98|
|C405|14102015|3|1068|176629|20033609,96|23020,44|
|C405|15102015|5|1069|176809|20054577,77|20885,81|
|C405|16102015|1|1070|177020|20077339,30|22456,53|
When mounting this regex
:
pattern : (\|C405\|\d+\|)\d
replace : $13
Here I have an error, because my intention is to do the replace of group 1 and after inserting the literal 3, but the same is interpreting as group 13, which does not exist. And even though I change the replace to $1
, the editor tries to capture both group 1 and group 3, as it interprets both ${digito}
and \{digito}
as mirrors.
The solution to this specific problem is quite simple:
pattern : (\|C405\|\d+)\|\d
replace : $1\|3
Question
Let's say that I do not have this solition, that I should capture a group and then insert a digit , such as inserting NOTHING in the middle of the terms?
$1{NADA}3
Obs
Without performing two REGEX operations:
pattern : (\|C405\|\d+\|)\d
replace : $1\x023
pattern : \x02
replace :