Sanjoy Roy

[MCM, MCP, SCJP] – Senior Programmer, Sites n Stores Pty Ltd.

Tag Archives: URL

URL Validation

If you want to validate an URL in input fields, here is the JS code: function isUrl(s) { var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/ return regexp.test(s); }

How to parse a URL?

If you want to parse a URL, here is the JS code: (please write a comment if you take this code) function parseURL(buffer) { var result = { }; result.protocol = “”; result.user = “”; result.password = “”; result.host = “”; result.port = “”; result.path = “”; result.query = “”; var section = “PROTOCOL”; var [...]

Follow

Get every new post delivered to your Inbox.