Make regex match exactly on entire string

The carot indicates start of string, the dollar the end of string. So it must match on the entire string, not a piece of it.

Contributes to issue CURA-2692.
This commit is contained in:
Ghostkeeper 2016-10-28 13:32:49 +02:00
parent 4ef2caddf5
commit d33f6d2e44
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -28,7 +28,7 @@ class MachineNameValidator(QObject):
# special character, and that up to [machine_name_max_length / 12] times.
maximum_special_characters = int(machine_name_max_length / 12)
unescaped = r"[a-zA-Z0-9_\-\.\/]"
self.machine_name_regex = r"((" + unescaped + "){0,12}|.){0," + str(maximum_special_characters) + r"}"
self.machine_name_regex = r"^((" + unescaped + "){0,12}|.){0," + str(maximum_special_characters) + r"}$"
validationChanged = pyqtSignal()