Add some string functions doc (#965)

This commit is contained in:
ZHAO Chun
2019-04-19 09:50:06 +08:00
committed by GitHub
parent b9054f537b
commit 22dc6119b9
3 changed files with 81 additions and 0 deletions

View File

@ -0,0 +1,27 @@
# regexp_replace
## Syntax
`VARCHAR regexp_replace(VARCHAR str, VARCHAR pattern, VARCHAR repl)
## Description
对字符串 str 进行正则匹配, 将命中 pattern 的部分使用 repl 来进行替换
## Examples
```
mysql> SELECT regexp_replace('a b c', " ", "-");
+-----------------------------------+
| regexp_replace('a b c', ' ', '-') |
+-----------------------------------+
| a-b-c |
+-----------------------------------+
mysql> SELECT regexp_replace('a b c','(b)','<\\1>');
+----------------------------------------+
| regexp_replace('a b c', '(b)', '<\1>') |
+----------------------------------------+
| a <b> c |
+----------------------------------------+
```