Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

RegExp.prototype.toString()

概要

指定されたオブジェクトを表す文字列を返します。

構文

regexObj.toString();

説明

その RegExp オブジェクトは Object オブジェクトの toString メソッドを上書きします。つまり、Object.toString を継承しません。RegExp オブジェクトにおける toString メソッドは、その正規表現オブジェクトを表す文字列を返します。

例: toString の使用

以下の例は正規表現オブジェクトの文字列の値を表示します。:

myExp = new RegExp("a+b+c");
alert(myExp.toString()); // "/a+b+c/" を表示します

参照

Object.prototype.toString

ドキュメントのタグと貢献者

 このページの貢献者: teoli, ethertank, Potappo, Mgjbot
 最終更新者: teoli,