(v0.19-24-g0617ca1 with changes)
#include <algorithm>
#include "Options.h"
#include <OptionsRegex.h>
#include "throwcall.h"
Go to the source code of this file.
|
int | main (int argc, const char *argv[]) |
|
◆ main()
int main |
( |
int |
argc, |
|
|
const char * |
argv[] |
|
) |
| |
Definition at line 7 of file regex_test.cpp.
10 auto strings = parser.fParse(argc, argv);
11 for (
const auto&
string : strings) {
12 std::cout <<
"testing string '" <<
string <<
"' against the regexp ";
13 regexp.fWriteOriginalString(std::cout);
17 std::cout <<
"search: \n";
18 if (std::regex_search(
string, match, regexp)) {
19 std::cout <<
"matches.\n";
20 std::cout <<
"prefix: '" << match.prefix() <<
"'\n";
21 for (
const auto& submatch : match) {
22 std::cout <<
"match '" << submatch <<
"'\n";
24 std::cout <<
"suffix: '" << match.suffix() <<
"'\n";
26 std::cout <<
"no match\n";
31 std::cout <<
"match: \n";
32 if (std::regex_match(
string, match, regexp)) {
33 std::cout <<
"matches.\n";
34 for (
const auto& submatch : match) {
35 std::cout <<
"match with " << submatch.length() <<
" chars";
36 std::cout <<
" from " << std::distance(
string.begin(), submatch.first);
37 std::cout <<
" to " << std::distance(
string.begin(), submatch.second);
38 if (submatch.length() > 0) {
39 std::cout <<
": '" << submatch <<
"'\n";
45 std::cout <<
"no match\n";