regex - vi: s: change K_KP4:"4", into myvars.setvar(K_KP4,"4") -


i though had when tried s/^\(k_.+\):\("."\),/myvars\.setvar(\1,\2)/g

i have 100 lines or k_kp4:"4" want change

i think problem \1 \2 refer different instances of same grouping pattern, means id'ing 2 different groups in vi regex impossible???

no luck sed

isn't there way of having name capturing group, a=>(k_.+) ?

in vi(m) regex, need escape + make act metacharacter.

:%s/^\(k_.\+\):\("."\)/myvars.setvar(\1,\2)/ 

also, g flag :s means replace instances on line. if there 1 instance per line, post suggests, g unnecessary , instead need specify command should run on lines in file -- :%s/...


Comments

Popular posts from this blog

hibernate - How to load global settings frequently used in application in Java -

objective c - Ownership modifiers with manual reference counting -

python 3.x - Mapping specific letters onto a list of words -