>>> b = re.compile('(\n+)?=item', re.IGNORECASE) >>> c = 'hello how are you \n\nITeM 84.2 rofl yo' >>> b.match(c) >>>