ポケット詳解JavaScript Node.js jQuery prototype.js対応

JavaScript基本オブジェクト - 正規表現(RegExp)

登録タグ
Icon comment count 0
Icon stock count 2

正規表現(RegExp)

正規表現オブジェクト

RegExp
regexp = new RegExp(パターン[, フラグ])

正規表現オブジェクトは、文字列のパターンマッチングを行うときに用いられます。

正規表現オブジェクトを生成します。

regexp = new RegExp(パターン[, フラグ])
Sample
<html>
    <head>
    <title>サンプル</title>
    <Script Language="Javascript">
    <!--
    function OpenAlert()
    {
        str = "ABCDEFGHI";
        re = new RegExp("DEF", "i");
        if (str.match(re)) {
            alert("DEFを含んでいます。");
   

コメント

    コメントはありません