Regex, replace path to resource, modify resource name

Posted by jerome on Stack Overflow See other posts from Stack Overflow or by jerome
Published on 2010-06-09T13:32:56Z Indexed on 2010/06/09 13:42 UTC
Read the original article Hit count: 248

Filed under:
|
|

Hi all,

I'd like to use a JS regex to take a string such as the following:

'http://www.somedomain.com/some_directory/some_other_directory/some_image.jpg'

And turn it into this:

'http://www.some_other_domain.com/another_directory/yet_another_directory/size1_some_image.jpg'

Any hints? Additionally, any pointers for books or other resources that give a gentle introduction to mastering regexes in JS and other languages?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about regex