The IP address of the IPV4 is (1~255). (0~255). (0~255). (0~255) format
The corresponding regular expression is given below:
"^ (1\\d{2}|2[0-4]\\d|25[0-5]| [1-9]\\d| [1-9]) \\."
+ "(1\\d{2}|2[0-4]\\d|25[0-5]| [1-9]\\d|\\d] \ \. "
+ "(1\\d{2}|2[0-4]\\d|25[0-5]| [1-9]\\d|\\d] \ \. "
+ "(1\\d{2}|2[0-4]\\d|25[0-5]| [1-9]\\d|\\d) $ "
The above one does not leak is the correct authentication IP regular expression, simple explanation
\\d represents any number of 0~9
{2} indicates exactly two occurrences
[0-4] represents any number of 0~4
| That means, or
() The parentheses above are not small enough to fetch a matching string, and several () in the expression represent several corresponding matching strings
1\\D{2} means any number between 100~199.
2[0-4]\\d means any number between 200~249.
25[0-5] means any number between 250~255.
[1-9]\\d means any number between 10~99.
[1-9]) It means any number between 1~9.
The point is to be escaped (special characters are similar, @ is added \ Escaped)
Speaking of which, it should be clear that the meaning of the above regular expression.
Reprint: http://blog.csdn.net/u012806692/article/details/50635590
Java Regular expression: IPV4 IP Address