If you still want to use regex you can use this:
import re
output = """123
143
153
abc!
abc
hhj
xyz--
xyz"""
print(output)
for line in output.split("\n"):
line = line.strip()
if re.search(r"^\babc\b$", line) or re.search(r"^\bxyz\b$", line):
print('line matched: {}'.format(line))
However, I would create a separate dictionary and look for the matches in there:
keywords = {'abc' : 0, 'xyz' :0, ...}
for line in output.split("\n"):
if line in keywords:
print('line matched: {}'.format(line))
Dictionary makes sense if you have a lot of keywords and they are all unique and your output file contains a lot of lines. The lookup time will be constant O(1).
If you use list of keywords the lookup will be O(n) which in total make your algorithm O(n^2).