Regex To Match The Last Occurrence Of Characters In A String

Category: Strings

A regular expression that matches the last occurrence of characters in a string.

/,\s([^,]+)$/

Matches:

  • regex, pattern, com
  • regex, pattern, com, more
  • regex, pattern.com

Non-matches:

  • regex.pattern.com
  • regexpattern.com

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.