I tried to compile the RegularExpression example from http://pocoproject.org/slides/040-StringsAndFormatting.pdf.
#include "Poco/RegularExpression.h"
#include <vector>
#include <iostream>
using Poco::RegularExpression;
int main(int argc, char** argv)
{
RegularExpression re2("([0-9]+) ([0-9]+)");
RegularExpression::MatchVec posVec;
re2.match("123 456", 0, posVec);
// posVec[0].offset == 0, posVec[0].length == 7
// posVec[1].offset == 0, posVec[1].length == 3
// posVec[2].offset == 4, posVec[2].length == 3
std::vector<std::string> vec;
re2.split("123 456", 0, vec);
// vec[0] == "123"
// vec[1] == "456"
std::cout << "vec[0]: " + vec[0] << std::endl;
std::cout << "vec[1]: " + vec[1] << std::endl;
return 0;
}
The stdout displays:
vec[0]
Segmentation fault (core dumped)
Process returned 139 (0x8B)
What is the matter?
Thanks,
Sylvain





