-
Notifications
You must be signed in to change notification settings - Fork 269
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update docs for string functions multi-match-any, multi-search-all-positions, ngram-search and tokenize #1948
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -24,31 +24,41 @@ specific language governing permissions and limitations | |||||||||
under the License. | ||||||||||
--> | ||||||||||
|
||||||||||
## multi_match_any | ||||||||||
### Description | ||||||||||
#### Syntax | ||||||||||
## Description | ||||||||||
|
||||||||||
`TINYINT multi_match_any(VARCHAR haystack, ARRAY<VARCHAR> patterns)` | ||||||||||
Returns whether the string matches any of the given regular expressions. | ||||||||||
|
||||||||||
## Syntax | ||||||||||
|
||||||||||
Checks whether the string `haystack` matches the regular expressions `patterns` in re2 syntax. returns 0 if none of the regular expressions are matched and 1 if any of the patterns matches. | ||||||||||
```sql | ||||||||||
TINYINT multi_match_any(VARCHAR haystack, ARRAY<VARCHAR> patterns) | ||||||||||
``` | ||||||||||
|
||||||||||
### example | ||||||||||
## Parameters | ||||||||||
|
||||||||||
``` | ||||||||||
mysql> select multi_match_any('Hello, World!', ['hello', '!', 'world']); | ||||||||||
| Parameter | Description | | ||||||||||
| -- | -- | | ||||||||||
| `haystack` | The string to be checked | | ||||||||||
| `patterns` | Array of regular expressions | | ||||||||||
Comment on lines
+41
to
+42
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
## Return Value | ||||||||||
|
||||||||||
Returns 1 if the string `haystack` matches any of the regular expressions in the `patterns` array, otherwise returns 0. | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
|
||||||||||
## Examples | ||||||||||
|
||||||||||
```sql | ||||||||||
mysql> SELECT multi_match_any('Hello, World!', ['hello', '!', 'world']); | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 不要prompt
Suggested change
|
||||||||||
+-----------------------------------------------------------+ | ||||||||||
| multi_match_any('Hello, World!', ['hello', '!', 'world']) | | ||||||||||
+-----------------------------------------------------------+ | ||||||||||
| 1 | | ||||||||||
+-----------------------------------------------------------+ | ||||||||||
Comment on lines
52
to
56
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 结果和查询分开放到两个 code block 中,结果使用 text 格式
|
||||||||||
|
||||||||||
mysql> select multi_match_any('abc', ['A', 'bcd']); | ||||||||||
mysql> SELECT multi_match_any('abc', ['A', 'bcd']); | ||||||||||
+--------------------------------------+ | ||||||||||
| multi_match_any('abc', ['A', 'bcd']) | | ||||||||||
+--------------------------------------+ | ||||||||||
| 0 | | ||||||||||
+--------------------------------------+ | ||||||||||
``` | ||||||||||
### keywords | ||||||||||
MULTI_MATCH,MATCH,ANY |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.