mirror of
https://github.com/spalencsar/bearhub.git
synced 2026-07-07 01:14:15 +02:00
13 lines
308 B
Python
13 lines
308 B
Python
import re
|
|
|
|
RE_STRIP_EPIC = re.compile(r'^\d+:')
|
|
RE_STRIP_RELEASE = re.compile(r'-[\d\.?]+$')
|
|
|
|
|
|
def clean_version(version: str) -> str:
|
|
treated_version = version.strip()
|
|
if treated_version:
|
|
return RE_STRIP_RELEASE.split(RE_STRIP_EPIC.split(treated_version)[-1])[0]
|
|
|
|
return treated_version
|