I would like to make a regular expression for an IP address with asterisk(*) which matches these below:
The digit 127.0 could be any number between 0 to 255.
**[TRUE]**
127.*.*.*
127.0.*.*
127.0.0.*
**[FALSE]**
127.*.*.1
127.*.0.1
127.0.*.1
What I have made until now is...and of course, failed to make it out. I totally got lost..
_regex = function(value) {
var _match = /^(?:(\d|1\d\d|2[0-4]\d|25[0-5]))\.(?:(\*|\d|1\d\d|2[0-4]\d|25[0-5]))\.(\*|(?:\d{1,2}(?:.\d{1,3}?)))\.(\*|(?:\d{1,3}(?:\*?)))$
if(_match.test(value)){
//do something;
}
}
If you give me any chance to learn this, would be highly appreciated. Thanks.