matchBefore

Match pattern against the text directly before the cursor on the current line (at most 250 characters back), returning the leftmost match that ends at the cursor, or null.