Regex To Matche A Slash At The End Of A String

A regular expression that matches a slash (/) at the end of a string.

Can be useful in finding if a string ended with or did not end with a slash (/) on the particular elements from an HTML page.

/\/$/

Matches:

  • https://regexpattern.com/
  • regex/
  • 12345/

Non-matches:

  • https://regexpattern.com/index.html
  • regex/pattern
  • 123/45

See Also: