I have a regular expression as defined
AAA_BBB_CCCC_(.*)_[0-9][0-9][0-9][0-9][0-1][0-9][0-3][0-9]T[0-2][0-9][0-5][0-9][0-5][0-9].
There is a string defined as --> **AAA_BBB_CCCC_DDD_EEEE_19710101T123456** and in the code, we have matcher.group(1) which can filter out what is desired as (DDD_EEEE). Now, I've a new string coming in as --> **AAA_BBB_ATCCCC_DDD_EEEE_19710101T123456**. Is there a way that I can change the regex to satisfy both old and new string? I tried few solutions that came up from Stackoverflow questions like this and others but that didn't work quite right for me.
(?:AT)?beforeCCCC.[0-9]{8}T[0-9]{6}in your regex. That is a little easier to understand ("8 digits, T, 6 digits"). After all, you'd have to further validate the input anyway, to avoid the 14th month, the 37th day of the month, or the 27th hour of the day.AAA_BBB_(?:AT)?CCCC_(.*)_\d{4}[01]\d[0-3]\dT[0-2]\d[0-5]\d[0-5]\d