1

次の 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)

[] の有効な文字として - 文字 (ダッシュ) を追加するにはどうすればよいですか?

4

1 に答える 1

2

pipe2 つの正規表現をマージするために使用できます。

((?:[^\W\d]|-)+)
于 2013-02-17T08:04:05.067 に答える