You can also use the option sub:
some_string <- "1_2_start_2007_3_end"
sub(".*_(\\d{4})_.*", "\\1", some_string)
regex
.* - 0+,_ - a _ char(\\d{4}) - 1 ( \1 ): 4_.* - a _, 0+ .
: akrun str_extract(some_string, "(?<=_)\\d{4}") , sub(".*_(\\d{4})_.*", "\\1", some_string) 4- , _. .: sub(".*?_(\\d{4})_.*", "\\1", some_string).
R test:
some_string <- "1_2018_start_2007_3_end"
sub(".*?_(\\d{4})_.*", "\\1", some_string)
sub(".*_(\\d{4})_.*", "\\1", some_string)