regex - Regular Expression: Insert between two characters -
my regular expression skills aren't great. i'm using sublime text , want replace between first 2 slashes (/
) different name. (this url flattening project.)
img src="/testing/graphics/real.gif"
you can replace result of following regex :
^/([^/]*)/(.*)
with :
/your_word/\2 #or /your_word/$2 languages
for example in python can :
>>> re.sub(r'^/([^/]*)/(.*)',r'/-------/\2',"/testing/graphics/real.gif") '/-------/graphics/real.gif'
Comments
Post a Comment