【发布时间】:2026-01-07 09:25:02
【问题描述】:
我希望使用 AND 条件组合多个正则表达式。例如,不应匹配以下单词(字符串开头):
database
audit
index
analysis
extract
good
bad
以这些字符串开头的字符串将不匹配。同理,others,error 等词也会被匹配。
我做了一个正则表达式,它能够过滤每个单词,但未能成功过滤掉不匹配的单词列表。
#This will only match those that do not start with database
r'(^((?!database).+)'
在尝试合并时,它未能检查两个条件。
r'(^((?!database).+)(^((?!audit).+)))'
注意:这个正则表达式要在django框架中使用,urls.py文件
【问题讨论】:
标签: django python-2.7 django-urls