JavaScript RegExp source attribute
- Forrige side multiline
- Næste side compile()
- Gå tilbage til niveauet over JavaScript RegExp Referencehåndbog
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 directly in the regular expression literals, 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 support
source
Er ECMAScript1 (ES1) egenskaber.
Alle browsere understøtter fuldt ES1 (JavaScript 1997):
Chrome | IE | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
Support | Support | Support | Support | Support | Support |
- Forrige side multiline
- Næste side compile()
- Gå tilbage til niveauet over JavaScript RegExp Referencehåndbog