Try using this regex for starters: [\\dA-Za-z]+_[\\dA-Za-z]+(\\.(?i)(csv))
.
It takes the part you had checking for the .csv
and adds a little more in front of it. It can be broken down into smaller parts:
[\\dA-Za-z]+
: any digit (\d
), a-z case insensitive. At least one (+
), could be more._
: exactly one underscore[\\dA-Za-z]+
: any digit, a-z case insensitive. At least one (+
), could be more.(\\.(?i)(csv))
: your already existing.csv
check.