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

android - Pass an Serializable object in AIDL -

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

How to use Authorization & Authentication in Asp.net, C#? -