(C++) Boost.Regex
January 17, 2018 ยท View on GitHub
Boost.Regex is a Boost library for regular expressions.
Example programs and code snippets

Boost.Regex example 1: basics
Boost.Regex example 2: replace
Boost.Regex example 3: basics
GetCppFilesInFolder: uses regex on filename
GetRegexMatches: obtain all regex matches from a std::string
Example boost::regexes
+--------------------------------------+--------------------------------------+
| Regex | Purpose |
+--------------------------------------+--------------------------------------+
| .*\.(h|hpp|c|cpp)\z | Test filename for .c, .cpp, .h or |
| | .hpp extension |
+--------------------------------------+--------------------------------------+
| \d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3} | IP address |
+--------------------------------------+--------------------------------------+
| http://(www\.)?(\w*\.)+\w* | General internet domain |
+--------------------------------------+--------------------------------------+
| here | Internet domain that checks for |
| | valid extensions |
+--------------------------------------+--------------------------------------+
| (\(\d,\(\d,\d\)\))|(\(\(\d,\d\),\d\ | Simple [Newick](CppNewick.md) | | )) | |
+--------------------------------------+--------------------------------------+
Note for Qt Creator users
Add the following line to your project file (to prevent link errors):
LIBS += -lboost_regex