javascript - How to get the 1st character after a pattern using regex? -


i'm trying first character after pattern.

i.e.

border-top-color padding-top  /-[a-z]/g 

selects:

border[-t]op[-c]olor padding[-t]op 

i want select:

border-[t]op-[c]olor padding-[t]op 

how first character after selected pattern?

example here! :)

just use capturing group:

"border-top-color".replace(/-([a-z])/g, "-[$1]") 

result:

"border-[t]op-[c]olor" 

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -