What I'm trying to achieve here is to say that we have two example URLs:
url1 = "http://emy.dod.com/kaskaa/dkaiad/amaa//////////" url2 = "http://www.example.com/"
How can I extract striped urls down?
url1 = "http://emy.dod.com/kaskaa/dkaiad/amaa" url2 = "http://http://www.example.com"
Ruby's URI.parse deactivates a certain type of malformed URL, but is ineffective in this case.
If we use a regular expression, then /^(.*)\/$/ removes one slash / from url1 and is invalid for url2 .
Does anyone know how to handle this type of URL parsing?
Here I do not want my system to http://www.example.com/ and http://www.example.com as two different URLs. The same goes for http://emy.dod.com/kaskaa/dkaiad/amaa//// and http://emy.dod.com/kaskaa/dkaiad/amaa/ .
ruby regex url-parsing malformed
splintercell
source share