boostorg / boostorg/xpressive

Building regex by vector of others

Open
#24 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
19
Forks
40
PR merge metrics
No merged PRs in 30d

Description

Hello.

I need to find which regex of N my string matches.

It's easy to implement if I have them compile time:
```cpp
sregex re = (s1 = re1)|(s2 = re2)|(s3=re3);
...
std::set foo(const std::string& str) {
std::set result;
smatch match;
if(regex_match(str, match, re)) {
for(int i = 0; i<3; ++i)
if(match[i+1]) result.insert(i);
}
return result;
}
```

But I have a vector:
```cpp
std::set foo(const std::string& str, const std::vector& reVector) {
sregex re;
int index = 1;
for(auto&& item : reVector) {
re |= (mark_tag(index++) = item); // (1)
}

std::set result;
smatch match;
if(regex_match(str, match, re)) {
for(int i = 0; i

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.