I would like to match all patterns XYZA where X,Y,Z,A are positive integers. For example,
10.4.3.9
11.20.5.6
Right now I have
if (str.matches("\d+\\.\d+\\.\d+\\.\d+")) { ... }
But for some reason this won't compile. Could anyone please enlighten me?
也逃跑之前反斜杠d
一次。
if (str.matches("\\d+\\.\\d+\\.\\d+\\.\\d+")) { ... }
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.