mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
regex: added documentation about multiple dots syntax error (#11147)
This commit is contained in:
parent
90adf4d092
commit
6771b7fea9
@ -133,17 +133,17 @@ Suppose you have `abccc ddeef` as a source string, that you want to parse
|
|||||||
with a regex. The following table show the query strings and the result of
|
with a regex. The following table show the query strings and the result of
|
||||||
parsing source string.
|
parsing source string.
|
||||||
|
|
||||||
+--------------+-------------+
|
|
||||||
| query string | result |
|
| query string | result |
|
||||||
|--------------|-------------|
|
|--------------|-------------|
|
||||||
| `.*c` | `abc` |
|
| `.*c` | `abc` |
|
||||||
| `.*dd` | `abcc dd` |
|
| `.*dd` | `abcc dd` |
|
||||||
| `ab.*e` | `abccc dde` |
|
| `ab.*e` | `abccc dde` |
|
||||||
| `ab.{3} .*e` | `abccc dde` |
|
| `ab.{3} .*e` | `abccc dde` |
|
||||||
+--------------+-------------+
|
|
||||||
|
|
||||||
The dot matches any character, until the next token match is satisfied.
|
The dot matches any character, until the next token match is satisfied.
|
||||||
|
|
||||||
|
**Important Note:** *Consecutive dots, for example `...`, are not allowed.*
|
||||||
|
*This will cause a syntax error. Use a quantifier instead.*
|
||||||
|
|
||||||
### OR token
|
### OR token
|
||||||
|
|
||||||
The token `|`, means a logic OR operation between two consecutive tokens,
|
The token `|`, means a logic OR operation between two consecutive tokens,
|
||||||
@ -481,13 +481,13 @@ re.flag = regex.F_BIN
|
|||||||
|
|
||||||
- `F_EFM`: exit on the first char matches in the query, used by the
|
- `F_EFM`: exit on the first char matches in the query, used by the
|
||||||
find function.
|
find function.
|
||||||
|
|
||||||
- `F_MS`: matches only if the index of the start match is 0,
|
- `F_MS`: matches only if the index of the start match is 0,
|
||||||
same as `^` at the start of the query string.
|
same as `^` at the start of the query string.
|
||||||
|
|
||||||
- `F_ME`: matches only if the end index of the match is the last char
|
- `F_ME`: matches only if the end index of the match is the last char
|
||||||
of the input string, same as `$` end of query string.
|
of the input string, same as `$` end of query string.
|
||||||
|
|
||||||
- `F_NL`: stop the matching if found a new line char `\n` or `\r`
|
- `F_NL`: stop the matching if found a new line char `\n` or `\r`
|
||||||
|
|
||||||
## Functions
|
## Functions
|
||||||
|
Loading…
Reference in New Issue
Block a user