Skip to content

Commit 4a1fb2d

Browse files
committed
Merge pull request astaxie#174 from better0332/patch-1
Update 07.3.md
2 parents 352e36f + 706ff66 commit 4a1fb2d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

ebook/07.3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Go语言通过`regexp`标准包为正则表达式提供了官方支持,如果
1919
如果要验证一个输入是不是IP地址,那么如何来判断呢?请看如下实现
2020

2121
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 {
22+
if m, _ := regexp.MatchString("^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$", ip); !m {
2323
return false
2424
}
2525
return true

0 commit comments

Comments
 (0)