RegExp.lastMatch
最後にマッチした文字列を得る
構文
RegExp.lastMatch
例文
<html> <head> <title>RegExp.lastMatch</title> </head> <body> <!--最後にマッチした文字列を得るのサンプル--> <script type="text/javascript"> var str = "ABCDEFG"; var rex = new RegExp("(B.+F)", "i"); if (str.match(rex)) { document.write(RegExp.lastMatch+"に最後にマッチしました。"); } else { document.write("マッチしません。"); } </script> </body> </html>
関連記事
- RegExp.$1〜$9
- RegExp
- String.match
- RegExp.rightContext
- RegExp.leftContext
- RegExp.lastParen
- RegExp.lastIndex
- RegExp.index
- RegExp.$n
スポンサーリンク