import re
pattern = re.compile( r"\b\d{2,12}\b" )
pattern_valid = re.compile( r"^\s*(?:(the|an?)\s+)?(cart|order)\b|\bdollar\s*$", re.I )
texts = ['the cart number is 1234 and 4567 that it!', 
    "order number note down 12345",
    "credit card is 0000 and 3456",
    "the 4567",
    "i got 245 dollar"]
for text in texts:
    if not pattern_valid.search(text):
        print(text, pattern.findall(text), sep=" => ")