JavaScript RegExp source attribute
- 上一页 multiline
- 下一页 compile()
- 返回上一层 Manwal ng Sanggunian ng RegExp ng JavaScript
Definition and usage
source
The property returns the text of the RegExp pattern.
description
RegExp object properties source
It is a read-only string. It stores the text of the RegExp pattern. This text does not include the delimiters used by the literal of the regular expression, nor does it include the flags g, i, m.
example
let text = "Visit CodeW3C.com"; let pattern = /W3S/g; let result = pattern.source;
syntax
regexp.source
return value
type | description |
---|---|
string | RegExp pattern text. |
browser supports
source
是 ECMAScript1 (ES1) 特性。
所有浏览器都完全支持 ES1 (JavaScript 1997):
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
支持 | 支持 | 支持 | 支持 | 支持 | 支持 |
- 上一页 multiline
- 下一页 compile()
- 返回上一层 Manwal ng Sanggunian ng RegExp ng JavaScript