473,406 Members | 2,345 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,406 software developers and data experts.

Regular expressions: string substitution with pcre or any other library?

Hi together,
most of the time I'm using .net framework to programm C++.
F.E. I can do the following:

Regex* rex;
String*
replacedTags=rex->Replace(originalLine,S"<(.*)?>,S"<SPECIAL>$1</SPECIAL>");

For a special program I would like to do the same in a standard C++ program.
I found the library pcre and after some starting problems I'm able to
compile and link to it.
But with this library I can only test if a string matches to a pattern
and extract the corresponding substring.
I think I would be able to write a function for replacing this
substring, but there must have someone before me who did this work
already ;-)

Searching with google "pcre string replace substitute" or whatever I did
not find any solution for pcre nor any other library for the same thing
(it must be a library which can be used with Windows XP).

Thank you for any hints, Bernd
--
BM Computer-Services, Bergmannstr. 66, 10961 Berlin
Webdesign, Internet, Layout und Grafik
Tel.: 030/20649400, mobil 0175/7419517, Fax: 030/20649401
Web: http://www.bmservices.de, eMail: ko*****@bmservices.de
Feb 15 '06 #1
2 3908
Bernd wrote:
Searching with google "pcre string replace substitute" or whatever I did
not find any solution for pcre nor any other library for the same thing
(it must be a library which can be used with Windows XP).


http://www.boost.org/libs/regex/doc/index.html

Boost is very often the place to look first in the context of C++.

It will work fine on Windows.

Jens

Feb 15 '06 #2
Jens Theisen schrieb:
Searching with google "pcre string replace substitute" or whatever I did
not find any solution for pcre nor any other library for the same thing
(it must be a library which can be used with Windows XP).


http://www.boost.org/libs/regex/doc/index.html

Boost is very often the place to look first in the context of C++.

It will work fine on Windows.


Thanks, that's a great library set. Like chrismas for c++ programmers ;-) B.

--
BM Computer-Services, Bergmannstr. 66, 10961 Berlin
Webdesign, Internet, Layout und Grafik
Tel.: 030/20649400, mobil 0175/7419517, Fax: 030/20649401
Web: http://www.bmservices.de, eMail: ko*****@bmservices.de
Feb 15 '06 #3

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

Similar topics

8
by: Eric Linders | last post by:
Hi, I'm trying to figure out the most efficient method for taking the first character in a string (which will be a number), and use it as a variable to check to see if the other numbers in the...
7
by: John | last post by:
I am fairly new to php but I think I must be completely missing the poiny here (or going mad) I would have expected this to match, am I right? if (eregi("a89", "a." )) {echo "<br>match";}...
6
by: Sébastien Boisgérault | last post by:
Hi, I'm searching for a POSIX 1003.2 compatible regular expression engine. The Python binding "pregex" by Neal Becker may do the job, but I did not manage to download it as the original link...
34
by: Antoine De Groote | last post by:
Hello, Can anybody tell me the reason(s) why regular expressions are not built into Python like it is the case with Ruby and I believe Perl? Like for example in the following Ruby code line =...
14
by: Chris | last post by:
I need a pattern that matches a string that has the same number of '(' as ')': findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = Can anybody help me out? Thanks for any help!
13
by: Wiseman | last post by:
I'm kind of disappointed with the re regular expressions module. In particular, the lack of support for recursion ( (?R) or (?n) ) is a major drawback to me. There are so many great things that can...
12
by: cmk128 | last post by:
Hi PHP's regular expression look like doesn't support .*? syntax. So i cannot match the shortest match. For exmaple: $str="a1b a3b"; $str1=ereg_replace("a.*b", "peter", $str1); will produce...
5
by: Noah Hoffman | last post by:
I have been trying to write a regular expression that identifies a block of text enclosed by (potentially nested) parentheses. I've found solutions using other regular expression engines (for...
47
by: Henning_Thornblad | last post by:
What can be the cause of the large difference between re.search and grep? This script takes about 5 min to run on my computer: #!/usr/bin/env python import re row="" for a in range(156000):...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.