|
@@ -62,16 +62,22 @@ def dig_it(search_in, default=0.00, fl_point=100, pattern=r'\d+') -> float:
|
|
|
return default
|
|
|
|
|
|
def re_check(string, pattern=r'(?<=;)[A-Za-z-]*\w [A-Za-z :.-]*(?=;)'):
|
|
|
+ string = re.sub(r'^[^a-zA-Z]+', '', string)
|
|
|
matches = re.findall(pattern, string, flags=re.RegexFlag.IGNORECASE)
|
|
|
- if string.startswith('Incasare') or string.startswith('Plata'):
|
|
|
- first_semicolon_index_from_end = string.rfind(';')
|
|
|
- second_semicolon_index_from_end = string.rfind(';', 0, first_semicolon_index_from_end)
|
|
|
- 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
|
|
|
- elif len(matches) == 0:
|
|
|
- ret_val = ''
|
|
|
- return ret_val
|
|
|
+ # if string.startswith('Incasare') or string.startswith('Plata'):
|
|
|
+ # first_semicolon_index_from_end = string.rfind(';')
|
|
|
+ # second_semicolon_index_from_end = string.rfind(';', 0, first_semicolon_index_from_end)
|
|
|
+ # 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:
|
|
|
+ matches = re.findall(r'\d+([A-Za-z-]+\s[A-Za-z :.-]*)', string)
|
|
|
+ if len(matches) == 0:
|
|
|
+ ret_val = ''
|
|
|
+ return ret_val
|
|
|
+ else:
|
|
|
+ ret_val = matches[0]
|
|
|
+ return ret_val
|
|
|
elif len(matches) > 1:
|
|
|
ret_val = matches[1]
|
|
|
return ret_val
|