Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个正则表达式(如下),但我如何将其限制为一个 1 实例或没有[. -:].
[. -:]
if re.match("[0-9a-fA-F]{2}([. -:]?[0-9a-fA-F]{2}){%d}$" % x, self.input_value):
谢谢,
?在一个组上使它成为可选的,这将是 1 或 0。
?
编辑删除显式版本