notepad++ - Regex replace one value between comma separated values -
i'm having bunch of comma separated csv files. replace exact 1 value between third , fourth comma. love notepad++ 'find in files' , replace functionality use regex.
each line in files this:
03/11/2016,07:44:09,327575757,1,5434543,...
the value replace in each line number 1 one.
it can't simple regex e.g. ,1,
somewhere else in line, must 1 after third , before fourth comma...
could me regex? in advance!
two more rows example:
01/25/2016,15:22:55,276575950,1,103116561,10.111.0.111,ngd.itemversions,0.401,0.058,w10,0.052,143783065,,... 01/25/2016,15:23:07,276581704,1,126731239,10.111.0.111,ll.browse,7.133,1.589,w272,3.191,113273232,,...
you can use
^(?:[^,\n]*,){2}[^,\n]*\k,1,
replace value need.
the pattern explanation:
^
- start of line(?:[^,\n]*,){2}
- 2 sequences of[^,\n]*
- 0 or more characters other,
,\n
(matched negated character class[^,\n]
) followed with,
- literal comma
[^,\n]*
- 0 or more characters other,
,\n
\k
- operator forces regex engine discard whole text matched far regex pattern,1,
- in match.
note \n
inside negated character classes prevent overflowing next lines in document.
Comments
Post a Comment