こういう正規表現を考えてみたけどgroup(2)とgroup(3)の区別はどうするんでしょうか?
Javaの実装なのでお願いします。
final String regex = "^(([a-zA-Z_-]+)|^([a-zA-Z_-]+\\d+[_\\-]))(\\d+)\\.txt$";