Test, validate and match regular expressions
Matches an underscore only when it is the last underscore in the string, using a lookahead to assert that no further underscores appear before the end. This is handy for splitting strings at the final delimiter, such as separating 'file_name_v2' into 'file_name' and 'v2', or for replacing/locating just the last underscore. The same technique works for other delimiters like dots or dashes by swapping the character in the pattern.