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

apache - Remove .php and add trailing slash in url using htaccess not loading css -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -