The title may be not appropriate but that I am trying to do is to cut url in certain condition. I want to create an regex which will throw away '/' at the end of the link.
For example
http://stackoverflow.com/questions/ask/
to
http://stackoverflow.com/questions/ask
I was able to archieve this with this ^(.*)\/
(example) but now I needed a change, and I'm not sure how it supposed to look.
Basically, the change I need is to DON'T touch the '/' if it is main page:
http://stackoverflow.com/ stays http://stackoverflow.com/
http://stackoverflow.com/questions/ changes to ttp://stackoverflow.com/questions
From my point of view it supposes to look if url are ended with text between two '/' and without any '.', but so far I am failing to make this condition.
How it potentially supposed to look?
EDIT
Some of the url may not contain http or https, so for me it is totally ok if regex regex will work on a normal text to.