regex
Regular expressions, the regex-lite dialect: no look-around or back-references. A pattern is compiled on every call; a match is a Match, with byte…
ในหน้านี้
Regular expressions, the regex-lite dialect: no look-around or back-references. A pattern is compiled on every call; a match is a Match, with byte offsets and one string per capture group, nil for a group that took no part.
6 functions, 0 constants. Scripts reach it as regex::.
Functions
Argument kinds are the script values a call passes: node is a node handle, any a table or value of any kind, fn a callback.
| function | acts on | what it does |
|---|---|---|
escape(string) -> string |
— | text with every metacharacter escaped, so it matches itself. |
matches(string, string) -> bool |
— | Whether the pattern matches anywhere in text. |
replace(string, string, string, bool?) -> string |
— | text with the first match replaced, or every match when all is true; $1 and ${name} in with stand for groups. |
search(string, string) -> regex::Match? |
— | The first match, or nil. |
search_all(string, string) -> [regex::Match] |
— | Every non-overlapping match, in order. |
split(string, string) -> [str] |
— | The pieces of text between matches. |