Regex To Match The Last Occurrence Of Characters In A String

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:

Regex Is Copied!