I need to implement a function that, given as input a filename, returns a substring according to the specifications of a regular expression
Filenames are composed this way, I need to get the string in bold
Doc20191001119049_fotocontargasx_3962122_943000.jpg
Doc201810011052053_fotoAssicurazioneCartaceo_3962128_943000.jpg
Doc201910011214020_fotoesterna_ant_396024_947112.jpg
Doc201710071149010_foto_TargaMid_4007396_95010.jpg
I have currently implemented this:
Pattern rexExp = Pattern.compile("_[a-zA-Z0-9]+_");
But not work properly