Queer European MD passionate about IT
Browse Source

Better variable regex: accept only one decimal separator in float numbers

Davte 1 year ago
parent
commit
51a77c695b
2 changed files with 4 additions and 3 deletions
  1. 1 1
      davtelepot/__init__.py
  2. 3 2
      davtelepot/administration_tools.py

+ 1 - 1
davtelepot/__init__.py

@@ -11,7 +11,7 @@ __author__ = "Davide Testa"
 __email__ = "davide@davte.it"
 __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"]
 __license__ = "GNU General Public License v3.0"
-__version__ = "2.9.2"
+__version__ = "2.9.3"
 __maintainer__ = "Davide Testa"
 __contact__ = "t.me/davte"
 

+ 3 - 2
davtelepot/administration_tools.py

@@ -36,8 +36,9 @@ from davtelepot.utilities import (
 rows_number_limit = 10
 
 command_description_parser = re.compile(r'(?P<command>\w+)(\s?-\s?(?P<description>.*))?')
-variable_regex = re.compile(r"(?P<name>[a-zA-Z][\w]*)\s*=\s*"
-                            r"(?P<value>[\d.,]+|True|False|"
+variable_regex = re.compile(r"(?P<name>[a-zA-Z]\w*)\s*=\s*"
+                            r"(?P<value>\d*[.,]?\d+|"
+                            r"True|False|"
                             r"'[^']*'|"
                             r"\"[^\"]*\")")