match
优质
小牛编辑
135浏览
2023-12-01
Creates a Sequence comprising all of the matches for the specified pattern in the underlying string.
Signature
StringLikeSequence.match = function(pattern) { /*...*/ }
StringLikeSequence.match = function match(pattern) { return new StringMatchSequence(this, pattern); }
Name | Type(s) | Description |
---|---|---|
pattern | RegExp | The pattern to match. |
returns | Sequence | A sequence of all the matches. |
Examples
Lazy("abracadabra").match(/a[bcd]/) // sequence: ["ab", "ac", "ad", "ab"] Lazy("fee fi fo fum").match(/\w+/) // sequence: ["fee", "fi", "fo", "fum"] Lazy("hello").match(/xyz/) // sequence: []