Internationalization and localization tools


Locale-Sensitive Python Method

re.match(pattern, string, flags=0)

Internationalization (I18n) Method Overview

The match function returns match object for the pattern at the beginning of the string.

Click here for more information.

I18n Issues

Defaults to ASCII only matching unless you use the re.L flag 'L' to set locale dependent mode.

re.I
re.IGNORECASE Perform case-insensitive matching; expressions like [A-Z] will also match lowercase letters. Full Unicode matching (such as Ü matching ü) also works unless the re.ASCII flag is used to disable non-ASCII matches. The current locale does not change the effect of this flag unless the re.LOCALE flag is also used. Corresponds to the inline flag (?i).

re.L
re.LOCALE Make \w, \W, \b, \B and case-insensitive matching dependent on the current locale. This flag can be used only with bytes patterns. The use of this flag is discouraged as the locale mechanism is very unreliable, it only handles one “culture” at a time, and it only works with 8-bit locales. Unicode matching is already enabled by default in Python 3 for Unicode (str) patterns, and it is able to handle different locales/languages. Corresponds to the inline flag (?L).
Changed in version 3.6: re.LOCALE can be used only with bytes patterns and is not compatible with re.ASCII.
Changed in version 3.7: Compiled regular expression objects with the re.LOCALE flag no longer depend on the locale at compile time. Only the locale at matching time affects the result of matching.

Please see Regular Expressions for more information.

Globalyzer will detect this method and report it as an I18n issue. If you have determined that the call is being handled correctly, you can use Globalyzer's Ignore Comment functionality to ensure that it isn't picked up in a subsequent scan.

Locale-Sensitive Python Methods

Lingoport internationalization and localization services and software