473,396 Members | 1,760 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

boost::regex_replace issue

Just practicing BOOST regular expressions....giving errors...
-- wanted to replace SPACE with NULL.
#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <iterator>
#include <boost/regex.hpp>
#include <fstream>
#include <iostream>

using namespace std;
boost::regex rex1;
extern const char* pre_expression= " ";
extern const char* pre_format="";

int main(void)
{
string line;
//boost::regex rex1(" ",boost::regex::perl|boost::regex::icase);
rex1.assign(pre_expression);
boost::regex rex2;

ifstream fh("/tmp/log.conf");
getline(fh,line);
cout << line << endl;

std::ostringstream osstr(std::ios::out);
std::ostream_iterator<char,charoi(osstr);
boost::regex_replace(oi,line.begin(),line.end(),re x1,pre_format,boost::
match_default | boost::format_all);

getline(fh,line);
cout << line << endl;
fh.close();
return 1;
}

##### g++ -o runme -ftemplate-depth-100 -I/home/azmath/dev/
boost_1_33_1/ -DBOOST_USER_CONFIG="</home/azmath/dev/boost_1_33_1/
boost/config/user.hpp>" -lboost_regex-gcc-d-1_33_1 classreadfile.cc

In file included from /home/azmath/dev/boost_1_33_1/boost/regex/v4/
regex.hpp:55,
from /home/azmath/dev/boost_1_33_1/boost/regex.hpp:
31,
from classreadfile.cc:6:
/home/azmath/dev/boost_1_33_1/boost/regex/v4/char_regex_traits.hpp: In
instantiation of
`boost::regex_traits<char,boost::cpp_regex_traits< char':

/home/azmath/dev/boost_1_33_1/boost/regex/v4/char_regex_traits.hpp:
38: instantiated from here

/home/azmath/dev/boost_1_33_1/boost/regex/v4/char_regex_traits.hpp:38:
base class `boost::cpp_regex_traits<char>' has incomplete type

/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp: In
instantiation of
`boost::basic_regex<char,boost::regex_traits<char, boost::cpp_regex_trai
ts<char >':

classreadfile.cc:14: instantiated from here

/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:186: no
type named `size_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<c har'

/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:187: no
type named `string_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<c har'

/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:202: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<c har'

/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:530: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<c har'

/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:530: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<c har'

/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:339: no
type named `locale_type' in `struct
boost::regex_traits<char,boost::cpp_regex_traits<c har'

/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp: In
method `class
boost::basic_regex<char,boost::regex_traits<char,b oost::cpp_regex_trait
s<char &
boost::basic_regex<char,boost::regex_traits<char,b oost::cpp_regex_trait
s<char >::assign(const char *, unsigned int =
boost::regex_constants::normal)':

classreadfile.cc:26: instantiated from here
/home/azmath/dev/boost_1_33_1/boost/regex/v4/basic_regex.hpp:239: no
method `boost::regex_traits<char,boost::cpp_regex_traits< char>
>::length'
classreadfile.cc: In function `int main()':
classreadfile.cc:48: wrong number of template arguments (2, should be
1)
/usr/include/g++/stl_iterator.h:875: provided for `template <class
_Tpostream_iterator<_Tp>'
classreadfile.cc:48: confused by earlier errors, bailing out

Jan 30 '07 #1
1 4427
On 29 Jan 2007 21:55:08 -0800 in comp.lang.c++, "Yahooooooooo"
<m.******@gmail.comwrote,
>Just practicing BOOST regular expressions....giving errors...
Your example compiles fine for me with MSVC 7, Windows.
You might want to try the Boost forums.

Jan 31 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: sbobrows | last post by:
{Whilst I think much of this is OT for this newsgroup, I think the issue of understanding diagnostics just about gets under the door. -mod} Hi, I'm a C++ newbie trying to use the Boost regex...
5
by: Lars Schouw | last post by:
I have downloaded the newest boos release. I am havng problems building boost using the intel C++ 8.0 compiler. It looks as if bjam can't fine the icl.exe compiler executable itself. This file is...
7
by: derek.google | last post by:
I hope a Boost question is not too off-topic here. It seems that upgrading to Boost 1.33 broke some old regex code that used to work. I have reduced the problem to this simple example: cout <<...
4
by: JDJMSon | last post by:
I was wondering if someone here could help me with a problem I'm having building Python extensions with the Boost.Python library. Basically, if I have a wrapper class with something like this: ...
7
by: Aek | last post by:
Hi everyone, I am trying to construct a regular expression and format string to use with a boost::regex_replace() In my file the sample text is: // .fx shader file FLOAT JOE 3545f; FLOAT...
5
by: FBergemann | last post by:
I use SunOS 5.8, gcc 3.3.2, boost 1.33.1. I have build the entire boost package and try to compile a simple example: #include <iostream> #include <string> #include <boost/regex.hpp //...
2
by: Paulo Matos | last post by:
Hi all, Guess I wish to do some parsing for a calculator which might include rational numbers. So I can have integers (sequence of digits possibly started by -) and rationals (two integers...
3
by: Yahooooooooo | last post by:
Hi, whats the issue in below code ... #include <iostream> #include <fstream> #include <sstream> #include <string> #include <iterator> #include <boost/regex.hpp>
1
by: Noah Roberts | last post by:
Trying to use boost::function in a C++/CLI program. Here is code: pragma once #include <boost/function.hpp> #include <boost/shared_ptr.hpp> #include <vector> using namespace System;
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.