[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ru/docs/Web/JavaScript/Reference/Global_Objects/RegExp/source [Back]  [Original]

RegExp.prototype.source - JavaScript | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

RegExp.prototype.source

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 ..

source , .

In this article

: source

js
var regex = /fooBar/gi;

console.log(regex.source); // 'fooBar',     /.../   'ig'.

ECMAScript 5, source . , " (?:)". , ( , "\n").

new RegExp().source; // "(?:)"

new RegExp('\n').source === '\n';  // true,   ES5
new RegExp('\n').source === '\\n'; // true,   ES5

Specification
ECMAScript 2027 LanguageSpecification
# sec-get-regexp.prototype.source


Web Proxy Viewer  |  New URL  |  Original Page