Answer
dfa is by far the best option. But if you cannot use it for any reason, try:
^(?!.*Factory|AppName)
It is very difficult to determine from your question and your regular expression what you are trying to do; they seem to imply the opposite behavior. The regular expression that I wrote will not match if Factory appears anywhere on the line or AppName appears at the beginning of it.
chaos source share