![]() |
Home | Libraries | People | FAQ | More |
You don't need to know much to start being productive with xpressive. Let's begin with the nickel tour of the types and algorithms xpressive provides.
Table 1.1. xpressive's Tool-Box
Tool |
Description |
---|---|
Contains a compiled regular expression. |
|
|
|
Checks to see if a string matches a regex. For |
|
Searches a string to find a sub-string that matches the regex.
|
|
Given an input string, a regex, and a substitution string, |
|
An STL-compatible iterator that makes it easy to find all the places
in a string that match a regex. Dereferencing a |
|
Like |
|
A factory for |
Now that you know a bit about the tools xpressive provides, you can pick the right tool for you by answering the following two questions:
Most of the classes in xpressive are templates that are parameterized on the iterator type. xpressive defines some common typedefs to make the job of choosing the right types easier. You can use the table below to find the right types based on the type of your iterator.
Table 1.2. xpressive Typedefs vs. Iterator Types
std::string::const_iterator |
char const * |
std::wstring::const_iterator |
wchar_t const * |
|
---|---|---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
You should notice the systematic naming convention. Many of these types are
used together, so the naming convention helps you to use them consistently.
For instance, if you have a sregex
,
you should also be using a smatch
.
If you are not using one of those four iterator types, then you can use the templates directly and specify your iterator type.
Do you want to find a pattern once? Many times? Search and replace? xpressive has tools for all that and more. Below is a quick reference:
Table 1.3. Tasks and Tools
To do this ... |
Use this ... |
---|---|
The |
|
The |
|
The |
|
|
The |
The |
|
The |
These algorithms and classes are described in excruciating detail in the Reference section.
![]() |
Tip |
---|---|
Try clicking on a task in the table above to see a complete example program that uses xpressive to solve that particular task. |