Any suggestion on how to extract testing 2021 from the list of variations below:
Name_Loc_Partner_testing 2021 - test
Name_Loc_Partner_testing 2021 - Abc-2021
Name_Partner_testing 2021 - Abc-2022
Partner_testing - 2021
Edited: ( I had the wrong character preceding the string I needed to extract)
Name_Loc_Partner - testing - test 2021 - test
Name_Loc_Partner - testing 2021 - Abc-2021
Name_Partner - testing 2021 - Abc-2022
Partner - testing - 2021
CodePudding user response:
Using REGEXP_EXTRACT with a capture group:
REGEXP_EXTRACT(val, '_([^_] \d{4})')
Here is a regex demo.
