cleanup, docs
This commit is contained in:
@@ -9,6 +9,7 @@ flags : optional regex flags
|
||||
return value : a DValue describing the first match
|
||||
|
||||
:see
|
||||
>string
|
||||
>regex
|
||||
regex_match
|
||||
regex_search_all
|
||||
@@ -21,19 +22,6 @@ Searches `subject` for the first occurrence of `pattern` and returns structured
|
||||
|
||||
Example:
|
||||
|
||||
```uce
|
||||
DValue match = regex_search(
|
||||
"(?<user>[A-Za-z0-9._%+-]+)@(?<host>[A-Za-z0-9.-]+)",
|
||||
"Contact ops@example.test"
|
||||
);
|
||||
|
||||
if(match["matched"].to_bool())
|
||||
{
|
||||
print(match["match"].to_string());
|
||||
print(match["named"]["user"].to_string());
|
||||
print(match["named"]["host"].to_string());
|
||||
}
|
||||
```
|
||||
|
||||
Return shape:
|
||||
|
||||
@@ -48,12 +36,9 @@ Return shape:
|
||||
|
||||
Capture entries contain:
|
||||
|
||||
```text
|
||||
capture["index"]
|
||||
capture["matched"]
|
||||
capture["start"]
|
||||
capture["end"]
|
||||
capture["text"]
|
||||
```
|
||||
|
||||
If no match is found, `matched` is `false` and match-specific fields are omitted.
|
||||
|
||||
:example
|
||||
DValue match = regex_search("docs", "uce docs");
|
||||
print(match["match"].to_string(), "\n");
|
||||
|
||||
Reference in New Issue
Block a user