We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 352e36f + 706ff66 commit 4a1fb2dCopy full SHA for 4a1fb2d
ebook/07.3.md
@@ -19,7 +19,7 @@ Go语言通过`regexp`标准包为正则表达式提供了官方支持,如果
19
如果要验证一个输入是不是IP地址,那么如何来判断呢?请看如下实现
20
21
func IsIP(ip string) (b bool) {
22
- if m, _ := regexp.MatchString("^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$", ip); !m {
+ if m, _ := regexp.MatchString("^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$", ip); !m {
23
return false
24
}
25
return true
0 commit comments