I don't know about regular expressions in Javascript, but actually you just want to match the name of the image and prepend it with a different path and append a different suffix to, so something like
preg_match('/^\com\/images\/s\/([a-z0-9_])+\.png$/', $href, $match);
$href = 'com/images/s/' . $match[1] . '.png';
- only in Javascript.
Best regards,
Andreas

