boost-regex

Cannot link Boost regex

霸气de小男生 提交于 2019-12-21 03:43:06
问题 I am currently trying to compile a Contraction Hierachies implementation by KIT which requires Boost::Regex. The supplied Makefile already makes sure (and I have also double-checked this manually) that g++ is supplied with the -lboost_regex switch. If the library is not installed, g++ will complain. So I installed the library from my package sources and tried compiling again. This time I am getting a huge load of linker errors regarding Boost::Regex. Here is a short excerpt: main.o: In

Why does regex_match throw “complexity exception”?

本秂侑毒 提交于 2019-12-19 19:45:35
问题 I am trying to test (using boost::regex ) whether a line in a file contains only numeric entries seperated by spaces. I encountered an exception which I do not understand (see below). It would be great if someone could explain why it is thrown. Maybe I am doing something stupid here in my way of defining the patterns? Here is the code: // regex_test.cpp #include <string> #include <iostream> #include <boost/regex.hpp> using namespace std; using namespace boost; int main(){ // My basic pattern

Boost Regex not playing welll with Snow leopard

China☆狼群 提交于 2019-12-19 10:19:43
问题 So I inherited code written in C++ that uses the Boost library. I could compile (using Code Blocks) and run the code on Linux Ubuntu but when I ported it over to the mac and installed the boost library, I can compile it using code blocks (and specifying the location of the regex libraries) but it won't run. It just gives me the error: $ ./BLAH_PD dyld: Library not loaded: libboost_regex.dylib Referenced from: /Users/spinach/Desktop/B/BLAH/bin/Release/./BLAH_PD Reason: image not found Trace

How can I find the index in a string that matches a boost regex?

╄→гoц情女王★ 提交于 2019-12-19 10:17:52
问题 How can I find the index in a string that matches a boost regex? 回答1: If you use boost::regex_match it's the whole string that's matching. Maybe you mean to use regex_search: void index(boost::regex& re,const std::string& input){ boost::match_results<std::string::const_iterator> what; boost::match_flag_type flags = boost::match_default; std::string::const_iterator s = input.begin(); std::string::const_iterator e = input.end(); while (boost::regex_search(s,e,what,re,flags)){ std::cout << what

regex_search and regex_replace with Boost

时间秒杀一切 提交于 2019-12-14 04:08:18
问题 I'm trying to loop among some strings delimited by a '$' pair in a line, replacing each match with a specific value in order to get an output line with all markers replaced but I'm stuck at the second match as I don't know how to concatenate the new replacement value: const boost::regex expression( "\\$[\\w]+\\$" ); string fileLine( "Mr $SURNAME$ from $LOCATION$" ); string outLine; string::const_iterator begin = fileLine.begin(); string::const_iterator end = fileLine.end(); boost::match

How to save/serialize compiled regular expression (std::regex) to a file?

倖福魔咒の 提交于 2019-12-14 01:23:37
问题 I'm using <regex> from Visal Studio 2010. I understand that when I create regex object then it's compiled. There is no compile method like in other languages and libraries but I thinks that's how it work, am I right? I need to store large amount of this compiled regexes in a file so I would just get chunk of memory block and get my compiled regex. I can't figure how to do this. I found that in PCRE it is possible but it's Linux library. There is a Windows [version2 but it's 3 years old and I

c++ Url Parser using boost regex match

╄→尐↘猪︶ㄣ 提交于 2019-12-12 13:49:20
问题 how can i parse an url in c++ with boost regex like i have an url http://www.google.co.in/search?h=test&q=examaple i need to split the base url www.google.com and then query path search?h=test&q=examaple 回答1: Are you sure you need regex for that? #include <iostream> #include <algorithm> int main() { using namespace std; string x = "http://www.google.co.in/search/search/?h=test&q=examaple"; size_t sp = x.find_first_of( '/', 7 /* skip http:// part */ ); if ( sp != string::npos ) { string base

Expression: string iterator not dereferencable while using boost regex

萝らか妹 提交于 2019-12-11 02:59:00
问题 I want to recover all the links from a page, while executing this code I get: Microsoft Visual C++ Debug Library Debug Assertion Failed! Program: C:\Users\Gandalf\Desktop\proxy\Debug\Proxy.exe File: C:\Program Files\Microsoft Visual Studio 10.0\VC\include\xstring Line: 78 Expression: string iterator not dereferencable For information on how your program can cause an assertion failure, see the Visual C++ documentation on asserts. (Press Retry to debug the application) Abort Retry Ignore void

Common symbols '\p{S}' not been 'matched' using boost wregex

三世轮回 提交于 2019-12-11 00:01:50
问题 I am using the code below to try and match symbols using regex, (as an example, I am trying to match the circle star symbol, http://graphemica.com/%E2%9C%AA) #include <boost/regex.hpp> //... std::wstring text = L"a✪c"; auto re = L"(\\p{S}|\\p{L})+?"; boost::wregex r(re); boost::regex_token_iterator<std::wstring::const_iterator> i(boost::make_regex_token_iterator(text, r, 1)), j; while (i != j) { std::wstring x = *i; ++i; } //... The byte value of text is {97, 10026, 99} , (or `{0x61,0x272A,

C++ to convert Boost Regex match result to other format [duplicate]

我只是一个虾纸丫 提交于 2019-12-10 11:10:01
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to convert a number to string and vice versa in C++ How should I convert the boost::regex match result to other format, like integer with below code? string s = "abc123"; boost::regex expr("(\\s+)(\\d+)"); boost::smatch match; if(boost::regex_search(s, match, expr)) { string text(match[0]); // code to convert match[1] to integer } 回答1: I'm sure you'd like to have string text(match[1]); // convert match[2] to