1
4

1 回答 1

2
$('p').html(function (_, str) {
  return str.replace(/video\?v=([^\s<]+)/g, function ($0, $1) {
    return ['<span id="', $1.substr(0, 8), '">', $0, '</span>'].join('');
  });
});​

http://jsfiddle.net/HcAyd/1/

于 2012-05-07T15:55:06.757 回答