Questions tagged [boost-xpressive]
36 questions
13
votes
5 answers
regex: boost::xpressive vs boost::regex
I wanted to do some regular expressions in C++ so I looked on the interwebz (yes, I am an beginner/intermediate with C++) and found this SO answer.
I really don't know what to choose between boost::regex and boost::xpressive. What are the…

orlp
- 112,504
- 36
- 218
- 315
5
votes
1 answer
How to iterate named groups in xpressive?
Say I have a sregex object like this one:
boost::xpressive::sregex::compile("(?P\\w+) (?\\w+)!");
I have not been able to find any reference in the xpressive documentation regarding this, despite xpressive supporting named…

hiobs
- 618
- 1
- 6
- 20
3
votes
1 answer
recursive boost::xpressive using too much memory
Hi boost::xpressive users,
I'm getting a stack overflow error when trying to parse some decision trees with boost::xpressive. It seems to work for trees up to a certain size, but fails on 'big' trees, where 'big' seems to mean around 3000 nodes, and…

user3445329
- 93
- 5
3
votes
1 answer
How to use boost::xpressive for populating a vector with structs within a semantic action
I was trying to insert a data struct into a vector everytime a match is detected, but i am failing even in compiling. The code is next:
#include
#include
#include
using…

Pablo
- 557
- 3
- 16
3
votes
1 answer
how to match multi-line text?
string str = "hello world!\r\naa=`xxx_1`\r\nhello world!";
sregex rx = sregex::compile(".+=`(.+)_1`");
smatch what;
if( regex_match( str, what, rx ) )
{
std::cout << what[1] << '\n';
}
this can't work, i use boost.xpressive not boost.regex, how…

travaller2
- 351
- 1
- 2
- 12
3
votes
1 answer
boost::xpressive to see the beginning of sequence
I am using boost::xpressive to parse through my text file. I want to see if only when the line begins with a '#' (one of more times).
I am using the following code
std::string str1 = "## this could be my line";
sregex rex1 =…

Ayesha Kalra
- 173
- 3
- 12
2
votes
1 answer
How to reference an optional submatch inside a semantic action with boost::xpressive static?
I have a boost xpressive sregex and semantic action that is equivalent to the following:
Rule = ('[' >> (s1=!(set=')',']','>')))[some_op(as(s1))];
Previously I was using this on boost 1.43 without any problems. I have had to upgrade to…

Malcolm MacLeod
- 624
- 7
- 15
2
votes
1 answer
Xpressive >>= Operator
I am toying around with Boost Xpressive and am having trouble with the following snippet
#include
#include
#include
using namespace std;
using namespace boost::xpressive;
int main()
{
string…

Freddie Witherden
- 2,369
- 1
- 26
- 41
2
votes
2 answers
Boost xpressive ! operator not working
I just started using Boost::xpressive and find it an excellent library... I went through the documentation and tried to use the ! operator (zero or one) but it doesn't compile (VS2008).
I want to match a sip address which may or may not start with…

rusbi
- 530
- 1
- 6
- 17
2
votes
1 answer
How to use boost.xpressive without entire boost?
I'm trying to use regular expression in VC 2008, however I can not use boost library (or at least the entire boost library).
I've seen the files in boost.xpressive are using files in other boost directories.
As a curiosity, this tutorial from…

milesma
- 308
- 3
- 11
2
votes
3 answers
How to parse mustache with Boost.Xpressive correctly?
I have tried to write a mustache parser with the excellent Boost.XPressive from the brilliant Eric Niebler. But since this is my first parser I am not familiar with the "normal" approach and lingo of compiler writers and feel a bit lost after a few…

patlecat
- 135
- 7
2
votes
1 answer
Boost Xpressive sregex assignment and capture group issue
I notice strange behavior in the boost xpressive sregex assignments. See the code below. The first code snippet that does not work has sregex has object preliminary assignments and then being used in the main expression later. The second code…

enthusiasticgeek
- 2,640
- 46
- 53
2
votes
2 answers
Can't get match with boost xpressive dynamic regex
Edit8: I've posted the solution first for anyone who might come along after me with the same problem.
Solution:
Assigned regex with = instead of invoking the () operator. Worked fine. That was stupid.
#include
#include
#include…

Logan Jones
- 324
- 1
- 3
- 10
2
votes
1 answer
What wildcard character in xpressive means the entire end of text?
With ANSI C PCRE I could extract sections and their content by means of:
(?ms)^\\[(.+?)\\](.*?)(?=\\n\\[|.\\z)
From [sec1] a = b [sec2] c = d
I got [sec1] a = b and [sec2] c = d
But how i can do it in xpressive?

Alex Bomb
- 63
- 3
1
vote
1 answer
Regular expression causing segfault/stack overflow
(or so I think)...
I'm using boost::xpressive as my regular expression engine to parse something and I get a segfault. I suspect that recursivity and my bad regular expression are to blame, because gdb shows more than 300 stack frames. So, here is…

dsign
- 12,340
- 6
- 59
- 82