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
Comments
Post a Comment