import re # The regex statements are designed to shortcut so are ordered from most common to least common. The advanced cases will also detect the same result as the simple cases. This is fine. def get_localization_regex_list(string): key = re.escape(string) # Regex is ordered from most common to least common return [ fr"window\.i18n\('{key}'\)", fr"window\.i18n\('{key}'(, {{[\S\s.]*}})?\)", fr"\{{ token: '{key}'(, args: {{.*}})? \}}", # This also captures the same group as `basic_object` but this is fine because basic_object shortcuts before reaching here if found. fr"{{\s+token: '{key}',?\s+(\s*args: {{[\S\s.]*}},)?\s+\}}", fr"window\.i18n\.(stripped|inEnglish|getRawMessage)\('{key}'(, {{[\S\s.]*}})?\)", fr"