Build, test, and debug regular expressions
This regex uses a greedy .* combined with a positive lookahead (?=CP) to position the match just before the last occurrence of 'CP' in a line. Because .* backtracks from the end of the string, capture group 1 ends up containing everything from the final 'CP' through the end of the input. It fails to match entirely if 'CP' never appears. Useful for extracting the tail portion of a string after the last occurrence of a marker, such as pulling a suffix from a path or log line.