I need a small parser (jquery) that knows if an input is URL:PORT format
- by Johua
You have a user input string from a textbox for example var strInput = $("#txtBox").val();
strInput has some string now. I need to now if it is of this format: IP:PORT
Basically a user can input something like this: http://192.168.300.22:20000
1) Frist part (protocol): http:// always needs to be replaced by: https://
2) Second part (everything until the ":" sign): 192.168.200.22 (or www.google.com)
3) Third part (port): everyhing after ":" (example: 9999, 100000)
I step): TAKE THE INPUT
var strInput = $("#txtBox").val();
II) step):
PARSE THE INPUT
III) results):
var strProtocol = "https//";
var strIP = parsedIP;
var strPORT = parsedPORT;
So i need 2 know how to get the values (parsedIP and parsedPORT).