String Localization and Regular Expressions

Marc Gregoire · 2018

This chapter starts with a discussion of localization, which allows a C++ programmer to write software that can be localized to different regions around the world. To make the source code localizable, a programmer should not compose sentences out of string literals, even if the individual literals can be localized. Next, the chapter introduces the regular expressions library, which makes it easy to perform pattern matching on strings. It allows him/her to search for substrings matching a given pattern, but also to validate, parse, and transform strings. Regular expressions are really powerful, and it is recommended that he/she starts using them instead of manually writing his/her own string processing code. Regular expressions can be used for several string-related operations, including validation, decision, parsing, transformation, iteration, and tokenization. There are several different grammars for regular expressions. For this reason, C++ includes support for several of these grammars: ECMAScript; basic; extended; awk; grep; and egrep.

Read the paper · More papers on PaperTik