jquery - javascript regular expression replace 3digitis from path string -
i have <img>
need change 2 digits path. have no idea in how write regular expressions.
<img src="/cms/ig/immopix/100/9165c73366c8830058b0f95c0fcacef5_100.jpg" /> ^ ^ | | ------------------------------------ | replace "1" in "6" looks ------------------------------------ | | <img src="/cms/ig/immopix/600/9165c73366c8830058b0f95c0fcacef5_600.jpg" />
the img name md5 value contain "100", cannot replace every "100". how can this?
so there few img tags in dom loop this
$('.object-overview-wrap').each(function(i){ var img = $(this).children('.img-wrap').children('img'); console.log(img.attr('src')); var imgsrc = img.attr('src'); img.attr('src', '/cms/ig/immopix/600/88f9f658ed1d506ce36b28565b79405f_600.jpg'); });
the console.log gives me: /cms/ig/immopix/100/9165c73366c8830058b0f95c0fcacef5_100.jpg replace, don't know how.
help , links explaining how write , use regular expressions appreciated!
you replace "/100/"
"/600/"
, "_100."
"_600."
.
regexes of course work here, it's simpler way.
Comments
Post a Comment