正则表达式: Demo(?!.*Test Demo)
代码示例(Python):
import re
string = "This is a Demo string"
match = re.search(r"Demo(?!.*Test Demo)", string)
if match:
print("Found a match:", match.group(0))
else:
print("No match found.")
输出:
Found a match: Demo