Say I want to write a regex to match text like "Table 1.1-1 Abcd" / "FIGURE 1: Efg" / "Image 1.1 Hijk lmn" but refuse "Table 1.1: abcd efg", which means the first letter behind "Table" / "Figure" ... must be uppercase, but "Table" and "TABLE", "Figure" and "FIGURE", "Image" and "IMAGE" ... can all be accepted. My colleagues had written regex with a flag re.IGNORECASE, so I don't want to change it too much. It's like pattern = re.compile(r"^(?!.*[._…-]{{3,}}\s*\d+$)([1-9]\d?)?\s?({})\s+({}):?\s?.*".format('|'.join(SECTION_KWT), SN_KW_SECTION), re.DOTALL | re.IGNORECASE) SECTION_KWT is a list containing words like "Table", "Figure" and others, SN_KW_SECTION is a str representing something like "1.1-1", "1", etc. I just want to modify the regex to specify that letter uppercase, but even I asked AI, I still cannot get a good solution. I tried [A-Z], (?-i) but none works. Continue reading...