JavaScript regular expressions verify port legality of IP address
if (!(/^[1-9]\d*$/.test(port) && 1 <= 1 * port && 1 * port <= 65535)){ return false }
Prompt copy:
Your port does not meet the range: 0-65535
PS: Let's take a look at JavaScript (Js) regular expression verification IP+port number
Development environment (blue bold text is special attention content)
1. Development language: JavaScript.
2. References: https:///article/
JavaScript verification of regular expressions for IP address and port, I won't thank you for taking it~~~
var ip="192.168.2.1:8080" var pattIp=/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\:([0-9]|[1-9]\d{1,3}|[1-5]\d{4}|6[0-5]{2}[0-3][0-5])$/; if((ip)==false) { return false; }
Summarize
The above is the JS regular expression verification port range (0-65535) introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support for my website!
If you think this article is helpful to you, please reprint it. Please indicate the source, thank you!