If the test strings do not require the use of a regular expression, recall that you can use Python's string functions and in
as well:
>>> line='protein_coding other stuff exon more stuff'
>>> "protein_coding" in line and "exon" in line
True
Or if you want to test an arbitrary number of words, use all
and a tuple of targets words to test:
>>> line='protein_coding other stuff exon more stuff'
>>> all(s in line for s in ("protein_coding", "exon", "words"))
False
>>> all(s in line for s in ("protein_coding", "exon", "stuff"))
True
And if the matches are something that require a regex and you want to limit to multiple unrelated regexes, use all
and a comprehension to test:
>>> p1=re.compile(r'\b[a-z]+_coding\b')
>>> p2=re.compile(r'\bexon\b')
>>> li=[p.search(line) for p in [p1, p2]]
>>> li
[<_sre.SRE_Match object at 0x10856d988>, <_sre.SRE_Match object at 0x10856d9f0>]
>>> all(e for e in li)
True