Reputation: 16711
I have a regex expression (below) but how do I restrict this to one 1 instance or no instances of [. -:]
.
if re.match("[0-9a-fA-F]{2}([. -:]?[0-9a-fA-F]{2}){%d}$" % x, self.input_value):
Thanks,
Upvotes: 1
Views: 203
Reputation: 10672
?
on a group makes it optional, which would be 1 or 0.
Edited to remove the explicit version
Upvotes: 7