在以下Python正则表达式中:
pattern = re.compile(r"""
^ # Match start of line.
([^\W\d]+) # One or more word characters (including ê, etc.; but excluding 0-9)
# as a returned group. Not \W and not \d.
$ # Match end of line.
""", re.VERBOSE + re.UNICODE)
如何在[]?
中添加 - 字符(破折号)作为有效字符答案 0 :(得分:2)
您可以使用pipe
合并两个正则表达式:
((?:[^\W\d]|-)+)