S
Shea Barton
I need to match a somewhat complicated match using gsub, then modify
part of it, leaving the rest intact
for example, replacing
"url(http://www.google.com)"
with
"url(HTTP://WWW.GOOGLE.COM)"
this is the closest answer I can come up with
gsub /(url\(['"]?)([^\)'"]+)(['"]?\))/, "\\1#{"\\2".capitalize}\\3"
or
gsub /(url\(['"]?)([^\)'"]+)(['"]?\))/, "\\1\\2.capitalize\\3"
but neither of these solutions work
It doen't have to be with gsub, I just thought this would be the most
straightforward way
ideas?
thanks
part of it, leaving the rest intact
for example, replacing
"url(http://www.google.com)"
with
"url(HTTP://WWW.GOOGLE.COM)"
this is the closest answer I can come up with
gsub /(url\(['"]?)([^\)'"]+)(['"]?\))/, "\\1#{"\\2".capitalize}\\3"
or
gsub /(url\(['"]?)([^\)'"]+)(['"]?\))/, "\\1\\2.capitalize\\3"
but neither of these solutions work
It doen't have to be with gsub, I just thought this would be the most
straightforward way
ideas?
thanks