Test, validate and match regular expressions
Matches the last comma on each line along with everything after it (any non-comma characters up to the end of the line). With the 'm' flag, '$' anchors to the end of every line, and 'g' applies it globally. It's commonly used to replace the final comma in each line with a semicolon, e.g., fixing trailing commas in CSV rows or SQL INSERT VALUES lists.