boost-regex

how to use Boost regular expression replace method?

ⅰ亾dé卋堺 提交于 2019-11-30 08:45:06
I have these variables: boost::regex re //regular expression to use std::string stringToChange //replace this string std::string newValue //new value that is going to replace the stringToChange depending on the regex. I only want to replace the first occurrence of it only. Thanks fellas. EDIT: I've found this: boost::regex_replace(stringToChange, re, boost::format_first_only); but it says the function does not exists, I'm guessing the parameters are incorrect at the moment. Here is an example of basic usage: #include <iostream> #include <string> #include <boost/regex.hpp> int main(){ std:

linking to boost regex in gcc

岁酱吖の 提交于 2019-11-30 08:34:01
问题 i am trying to compile my program which uses regex on linux. I built the boost library in the libs/regex/build by typing make -fgcc.mak which created a directory gcc which contains the following four files boost_regex-gcc-1_35 boost_regex-gcc-d-1_35 libboost_regex-gcc-1_35.a libboost_regex-gcc-d-1_35.a Now I want to use regex from my program which is in some arbitrary directory. I #included boost/regex.hpp I got the error which stated that regex.hpp is not found. Then I gave the -I option in

fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1_42.lib'

Deadly 提交于 2019-11-30 05:37:14
i'm trying to use boost regex within my program the problem is i get this error... the only installation step i did was to add: "C:\Program Files\boost\boost_1_42" into the Additional Include Directories... i'm using VS2008... trying to implement this: #include <iostream> #include <string> #include <boost/regex.hpp> using namespace std; int main( ) { std::string s, sre; boost::regex re; boost::cmatch matches; while(true) { cout << "Expression: "; cin >> sre; if (sre == "quit") { break; } cout << "String: "; cin >> s; try { // Assignment and construction initialize the FSM used // for regexp

how to use Boost regular expression replace method?

时间秒杀一切 提交于 2019-11-29 12:00:43
问题 I have these variables: boost::regex re //regular expression to use std::string stringToChange //replace this string std::string newValue //new value that is going to replace the stringToChange depending on the regex. I only want to replace the first occurrence of it only. Thanks fellas. EDIT: I've found this: boost::regex_replace(stringToChange, re, boost::format_first_only); but it says the function does not exists, I'm guessing the parameters are incorrect at the moment. 回答1: Here is an

linking to boost regex in gcc

自闭症网瘾萝莉.ら 提交于 2019-11-29 07:18:04
i am trying to compile my program which uses regex on linux. I built the boost library in the libs/regex/build by typing make -fgcc.mak which created a directory gcc which contains the following four files boost_regex-gcc-1_35 boost_regex-gcc-d-1_35 libboost_regex-gcc-1_35.a libboost_regex-gcc-d-1_35.a Now I want to use regex from my program which is in some arbitrary directory. I #included boost/regex.hpp I got the error which stated that regex.hpp is not found. Then I gave the -I option in the g++ compiler. I didn't get that error. But I get the following error undefined reference to `boost:

fatal error LNK1104: cannot open file 'libboost_regex-vc90-mt-gd-1_42.lib'

橙三吉。 提交于 2019-11-29 03:37:41
问题 i'm trying to use boost regex within my program the problem is i get this error... the only installation step i did was to add: "C:\Program Files\boost\boost_1_42" into the Additional Include Directories... i'm using VS2008... trying to implement this: #include <iostream> #include <string> #include <boost/regex.hpp> using namespace std; int main( ) { std::string s, sre; boost::regex re; boost::cmatch matches; while(true) { cout << "Expression: "; cin >> sre; if (sre == "quit") { break; } cout

C++ Regular Expressions with Boost Regex

荒凉一梦 提交于 2019-11-27 20:17:50
I am trying to take a string in C++ and find all IP addresses contained inside, and put them into a new vector string. I've read a lot of documentation on regex, but I just can't seem to understand how to do this simple function. I believe I can use this Perl expression to find any IP address: re("\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"); But I am still stumped on how to do the rest. Perhaps you're looking for something like this. It uses regex_iterator to get all

C++ Regular Expressions with Boost Regex

为君一笑 提交于 2019-11-26 20:16:39
问题 I am trying to take a string in C++ and find all IP addresses contained inside, and put them into a new vector string. I've read a lot of documentation on regex, but I just can't seem to understand how to do this simple function. I believe I can use this Perl expression to find any IP address: re("\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\b"); But I am still stumped on how