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>

関連記事

スポンサーリンク

MySQLのソケットエラー

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る