日期与符号和结束符号的模式匹配

我在请求中获得的ID具有特定格式的日期,并且没有他们尝试在我的API上获得的匹配,如果它是当天的最后匹配,则以字符串形式结束。 我的变量是

@Pattern(regexp = "^\\d{8}_.*", message = "Field 'batchId' invalid.please provide in format yyyyMMdd_<digit/end>")
    private String batch Id;

for example 20200509_001 for the first try or 20200509_9999999 for 9999999 hits ie format yyyyMMdd_no_of_tries or 20200509_end ie yyyyMMdd_end for the last hit of the day (this end can be case insensitive.) but 1 of them must be there, either no_of_tries or end 20200509_ this is invalid.

I need to prepare a pattern for this., so far I have come up "^\\d{8}_.*" it matches up to 8 digits, but I am not able to match digits or string after the _.