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?
This is what I was looking for:
find: \D+_(\d+)_.*
replace: $1
I didn't know about the "non-digit" character!