Regex To Matche A Slash At The End Of A String

Category: Strings

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:

Rate This Regex
Sending
User Review
0 (0 votes)

Expression Flags

Flags Description
i Ignore case sensitive.
g Allows global search.
m Allows multiline search.