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





