mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 06:19:44 +08:00
Update 09.2.md
MatchString
This commit is contained in:
@@ -13,7 +13,7 @@ ok, _ := regexp.Match(pat, []byte(searchIn))
|
|||||||
变量 ok 将返回 true 或者 false,我们也可以使用 `MatchString`:
|
变量 ok 将返回 true 或者 false,我们也可以使用 `MatchString`:
|
||||||
|
|
||||||
```go
|
```go
|
||||||
ok, _ := regexp.MathString(pat, searchIn)
|
ok, _ := regexp.MatchString(pat, searchIn)
|
||||||
```
|
```
|
||||||
|
|
||||||
更多方法中,必须先将正则通过 `Compile` 方法返回一个 Regexp 对象。然后我们将掌握一些匹配,查找,替换相关的功能。
|
更多方法中,必须先将正则通过 `Compile` 方法返回一个 Regexp 对象。然后我们将掌握一些匹配,查找,替换相关的功能。
|
||||||
|
Reference in New Issue
Block a user