summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--python/002-simple-re-within-string.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/002-simple-re-within-string.py b/python/002-simple-re-within-string.py
new file mode 100644
index 0000000..5259418
--- /dev/null
+++ b/python/002-simple-re-within-string.py
@@ -0,0 +1,9 @@
+version_start, version_stop = reduce(
+ lambda acc, x: (acc[0] if acc[0] or not x[1].isdigit() else x[0]+1,
+ acc[0] if not x[1].isdigit() else x[0]+1),
+ enumerate(options.version), (0, 0)
+)
+if not version_start:
+ options.version = '0'
+else:
+ options.version = options.version[version_start-1:version_stop]