Skip to content

Commit 706ff66

Browse files
committed
Update 07.3.md
"^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$" should be "^[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}$"
1 parent 2075119 commit 706ff66

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)