Jelajahi Sumber

correct the reversion if match 0

marton levente 7 bulan lalu
induk
melakukan
bc469f9105
1 mengubah file dengan 3 tambahan dan 1 penghapusan
  1. 3 1
      pymt940/utils.py

+ 3 - 1
pymt940/utils.py

@@ -70,7 +70,9 @@ def re_check(string, pattern=r'(?<=;)[A-Za-z-]*\w [A-Za-z :.-]*(?=;)'):
         third_semicolon_index_from_end = string.rfind(';', 0, second_semicolon_index_from_end)
         ret_val = string[third_semicolon_index_from_end + 1:second_semicolon_index_from_end]
         return ret_val
-    # if len(matches) == 0:
+    elif len(matches) == 0:
+        ret_val = ''
+        return ret_val
     #     matches = re.findall(r'\d+([A-Za-z-]+\s[A-Za-z :.-]*)', string)
     #     if len(matches) == 0:
     #         ret_val = ''