I have this text and I want to replace each line with the first number that occurs in the line.
E.g.:
Affiliate,"0,00 €","1,13","0,00 €","0,00 €","0,00 %"
Bing - brand,"45,11 €","0,31","145,98 €","0,00 €","0,00 %"
Bing - nonbrand,"39,90 €","0,00","0,00 €","0,00 €","0,00 %"
Would become:
0,00
45,11
39,90
Can you help me on that?
My so far regex is:
(.*),"(.*),"(.*),"(.*),"(.*),"(.*)
with output $2
But that looks terrible and also doesn't give me the wanted result.
You may try the following find and replace, in regex mode:
Find: ^\D*(\d+(?:,\d+)?).*$
Replace: $1
Here is an explanation of the regex pattern:
^
from the start of the line\D*
consume zero or more non digit characters(\d+(?:,\d+)?)
match and capture in $1
the first digit, with optional decimal.*
consume the rest of the line$
end of the lineHere is a working demo.