Skip to content

Commit 041419b

Browse files
author
Sami Shahin
committed
Fix: Expand regular expression for version
- Combined regex patterns - Added optional version suffix This adds support for versions that use a string after the semver.
1 parent 188b4e2 commit 041419b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

operatorcourier/validate.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,8 @@ def is_email(field):
371371
return True
372372

373373
def is_version(field):
374-
pattern1 = re.compile(r'v(\d+\.)(\d+\.)(\d)')
375-
pattern2 = re.compile(r'(\d+\.)(\d+\.)(\d)')
376-
return pattern1.match(field) or pattern2.match(field)
374+
pattern = re.compile(r'(v)?(\d+\.)(\d+\.)(\d)(-[a-z0-9\.])*')
375+
return pattern.match(field)
377376

378377
def is_capability_level(field):
379378
levels = [

0 commit comments

Comments
 (0)