我想用JS正則表達式來採取一個字符串,如下列:正則表達式,更換道路資源,修改資源名稱
'http://www.somedomain.com/some_directory/some_other_directory/some_image.jpg'
,把它變成這樣:
'http://www.some_other_domain.com/another_directory/yet_another_directory/size1_some_image.jpg'
任何提示?此外,書籍或其他資源的任何指針,可以輕鬆地介紹如何在JS和其他語言中掌握正則表達式?
按照jerome的說法,這應該是''http://abc.com/def/ghi/size1_'+ bits [bits.length-1]'。 – JAB 2010-06-09 13:50:05
@jab:你注意到jerome沒有使用'abc.com/def/ghi'嗎? – SilentGhost 2010-06-09 13:54:30
'http:// www.some_other_domain.com/another_directory/yet_another_directory/size1_'然後,使用jerome的示例URL和文件名前綴。 – JAB 2010-06-09 14:15:07