replace - regex quandry with replacing in sublime text -
i'm getting comfortable enough regex use in everyday work. saves me ton of time, , type. problem lies in sometimes, have no idea typed or why works way.
i'm working using round brackets grouping, incredibly useful when sorting through lists, dumps, yardwork, etc. i've hit basic don't understand
say have simple query looks specific group of characters individually instance:
([a-z])
this need to. if need split result 1 line per character i'm using:
\1\n
this works wonders. simple yet effective. comes quandry. how add 1 directly after each character? i.e.
input:
john
output:
j1 o1 h1 n1
i've attempted using:
\1 1\n #gives me space \11\n #gives me newlines "1" on each line.
and interesting one:
(\1)1\n
which outputs:
()1 ()1 ()1 ()1 ()1
how accomplish this?
i think keyword search "named capturing groups" backreferences. http://www.regular-expressions.info/named.html
they \0 thru \9 exact use case you're describing.
Comments
Post a Comment