String.match
正規表現でマッチさせる
構文
stringObject.match(searchvalue)
引数
searchvalue=検索文字列 or 正規表現例文
<html>
<head>
<title>String.match</title>
</head>
<body>
<!--正規表現でマッチさせるのサンプル-->
<script type="text/javascript">
var str="String Hello";
document.write(str.match("hello")+"<br>");
document.write(str.match("Hello")+"<br>");
document.write(str.match("test")+"<br>");
document.write(str.match(/H.+o/)+"<br>");
document.write(str.match(/S.+H/i));
</script>
</body>
</html>
関連記事
- RegExp.$1〜$9
 - RegExp
 - RegExp.rightContext
 - RegExp.leftContext
 - RegExp.lastParen
 - RegExp.lastMatch
 - RegExp.lastIndex
 - RegExp.index
 - RegExp.$n
 
スポンサーリンク





