Short answer
Either:
,[\s\S]*$
or ,.*$
to match everything after the first comma (see explanation for which one to use); or
[^,]*$
to match everything after the last comma (which is probably what you want).
You can use, for example, /[^,]*/.exec(s)[0]
in JavaScript, where s is the original string. If you wanted to use multiline mode and find all matches that way, you could use s.match(/[^,]*/mg)
to get an array (if you have more than one of your posted example lines in the variable on separate lines).
Explanation
[\s\S]
is a character class that matches both whitespace and non-whitespace characters (i.e. all of them). This is different from .
in that it matches newlines.
- `[^,] is a negated character class that matches everything except for commas.
*
means that the previous item can repeat 0 or more times.
$
is the anchor that requires that the end of the match be at the end of the string (or end of line if using the /m multiline flag).
For the first match, the first regex finds the first comma ,
and then matches all characters afterward until the end of line [\s\S]*$
, including commas.
The second regex matches as many non-comma characters as possible before the end of line. Thus, the entire match will be after the last comma.