在 re.search 中对 python 中的多个字符串使用 OR 运算符 3

Using OR operator in re.search for multiple strings in python 3

抱歉,如果有人问过这个问题,但我找不到。我试图检测网站是否使用 wordpress。这是示例代码。

url = input("Please enter the URL")
if 'http://' in url:
    append = url
else:
    append = 'http://' + url
r = requests.get(append + "/robots.txt")
    response = r.text
if re.search(('/wp-includes/') | ('/wp-admin/'), response):
    print("{0} --> Its Wordpress ".format(append))
    sys.exit(0)

它说 |在

中不能使用运算符
if re.search(('/wp-includes/') | ('/wp-admin/'), response): 

我如何搜索多个字符串,并在它们之间使用 OR?我也试过使用 'or' 并试过这个

if re.search('/wp-includes/' , '/wp-admin/'), response):

谢谢

how can i search for multiple strings, with OR between them?

使用交替运算符|

if re.search(r'/wp-(?:admin|includes)/', response):

正则表达式模式是单个字符串。

'(foo|bar)'