| [ Web Proxy ] |
| Viewing: https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/RegExp/toString | [Back] [Original] |
Get to know MDN better
console.log(new RegExp("a+b+c"));
// : /a+b+c/
console.log(new RegExp("a+b+c").toString());
// : "/a+b+c/"
console.log(new RegExp("bar", "g").toString());
// : "/bar/g"
console.log(new RegExp("\n", "g").toString());
// : "/\n/g"
console.log(new RegExp("\\n", "g").toString());
// : "/\n/g"
toString()
RegExp toString() Object Object.prototype.toString() RegExp toString()
source flags /source/flags toString() ()
const myExp = new RegExp("a+b+c");
console.log(myExp.toString()); // '/a+b+c/'
const foo = new RegExp("bar", "g");
console.log(foo.toString()); // '/bar/g'
toString() source "/(?:)/" \n
new RegExp().toString(); // "/(?:)/"
new RegExp("\n").toString() === "/\\n/"; // true
| ECMAScript 2027 LanguageSpecification # sec-regexp.prototype.tostring |
| Web Proxy Viewer | New URL | Original Page |