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

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

linux - disk space limitation when creating war file -

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