Home » ★JavaScriptリファレンス

★JavaScriptリファレンス

RegExp.ignoreCase …… 大文字と小文字の違いを無視するかどうかを返す

Internet Explorer
Google Chrome
Safari
Firefox
Opera
広告



RegExpオブジェクトのignoreCaseプロパティは、正規表現オブジェクトが大文字と小文字の違いを無視するかどうか(正規表現で”i”フラグがオプション指定されているかどうか)を返します。

正規表現で”i”フラグがオプション指定されている場合には、RegExp.ignoreCaseの戻り値はtrueとなり、大文字と小文字の違いを無視します。

■構文・引数・戻り値

構文
RegExp.ignoreCase
戻り値
正規表現オブジェクトが大文字と小文字の違いを無視するかどうかを true または false で返す

■使用例

HTML + JavaScriptソース

<script>
sample1 = /BaseBall VolleyBall BasketBall/i;
document.write("<div>大文字と小文字を区別するかどうか1: " + sample1.ignoreCase + "</div>");

sample2 = /BaseBall VolleyBall BasketBall/;
document.write("<div>大文字と小文字を区別するかどうか2: " + sample2.ignoreCase + "</div>");
</script>

↓↓↓

ブラウザ上の表示

“);

sample2 = /BaseBall VolleyBall BasketBall/;
document.write(“

大文字と小文字を区別するかどうか2: ” + sample2.ignoreCase + “

“);

Lorem Ipsum is simply dummy text

    By signing up, you agree to our Terms and Privacy Policy. Unsubscribe anytime.