Remove last slash from URL with regex -


i have following regex remove last slash url:

(.*)\/ 

i.e.: http://www.domain.com/clients/

if applied regex example, work fine, problem when url not have last slash (it occur time time). removes /clients.

how can avoid situation?

regex remove last slash in url

\/$ 

explanation:

\/ matches character / literally $ assert position @ end of line 

demo


Comments

Popular posts from this blog

How to provide Authorization & Authentication using Asp.net, C#? -

toolbar - How to add link to user registration inside toobar in admin joomla 3 custom component -

android - Pass an Serializable object in AIDL -