I have a bunch of strings that look similar to:
"TEST1_TEST_1995_12_324324_whatever"
"test2_test_3_4_2001_test"
What I am trying to do is get a substring up to but not including the underscore just before 4 digits in a row plus another underscore. In the above two examples, the first substring should give me "TEST1_TEST" because after that is the pattern underscore, four digits, underscore (1995).
The second example should give me "test2_test_3_4" because the pattern after that is, again, underscore, four digits, underscore (2001).
I've been messing around with regex but can't seem to get close.