I'm trying to design a single regex that produces the two following scenarios:

```
foobar_foobar_190412_foobar_foobar.jpg  =>  190412
foobar_20190311_2372_foobar.jpg         =>  20190311

```

The regex I came up with is close, but I can't figure out how to make it only output the first number:

```
.*_(\d+)_(\d*).*                        =>  $1

foobar_foobar_190412_foobar_foobar.jpg  =>  190412
foobar_20190311_2372_foobar.jpg         =>  (no match)

```

Anyone got an idea?