→ giacch: Opera 02/28 23:21
推 xrancyma:感覺很像是BUG…該不會 IE 和 FF 的 BUG 都一樣吧? 03/01 00:40
補充一下...
<script type='text/javascript'>
var htmlText="<bodya> .. <bodyb> .... <bodyc>";
alert( "A: " + htmlText.match(/(<body.?>)/g) ); // A: <bodya>,<bodyb>,<bodyc>
alert( "B: " + htmlText.match(/(<body.?>)/g).length ); // B: 3
alert( "C: " + htmlText.match(/(<body.?>)/g)[0] ); // C: <bodya>
alert( "D: " + htmlText.match(/(<body.?>)/g)[1] ); // D: <bodyb>
alert( "E: " + htmlText.match(/(<body.?>)/g)[2] ); // E: <bodyc>
alert( "F: " + htmlText.match(/(<body.?>)/g)[3] ); // F: undefined
</script>
以下取自 http://www.w3schools.com/jsref/jsref_obj_regexp.asp
exec() Search a string for a specified value. Returns the found
value and remembers the position
match() Search a string for a specified value. Returns an array
of the found value(s)
( ) Finds the group of characters inside the parentheses
and stores the matched string
→ giacch: 爆... XD 03/01 01:09
※ 編輯: giacch 來自: 118.232.172.163 (03/01 01:17)