473,471 Members | 1,900 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

iterating over sub-matches using std::tr1::regex?

Given a repeatable group expression

([abc])+

and given its input

cab

will result in nested subgroups, which taken from 'rad software
regular expression tester' looks like

Match 'cab'
- Group 1
- c at pos 0 length 1
- a at pos 1 length 1
- b at pos 2 length 1

Id like to use the regex classes found in std::tr1 to iterate over all
the matches in Group1.

Im using regex_search to fill a smatch object. I need to go one more
step to iterate over the matches found in Group1. Can anyone tell me
what I need to do to iterate over the sub-matches?

I've tried the following, but it doesnt seem to work

// note: initialResults is sucessfully filled with a single group
match
regex_search( "cab", initialResults, "([abc])+" );

for ( size_t ii = 1; ii < initialResults.size(); ++ii )
{
ssub_match groupResults;
// note: groupResults.matches is false. groupResults.first is
NULL, as is groupResults.second
groupResults.compare( initialResults[ ii ] );
}

Thanks for any assistance!
-Velik

Aug 13 '08 #1
1 3305
ok, this thread has been kicked dead. please dont reply to any more
of my threads.

Thanks
Aug 13 '08 #2

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

Similar topics

3
by: Patrick von Harsdorf | last post by:
I want to iterate over a collection and delete all unwanted entries. for item in collection: del item of course doesn´t do anything useful. Two things come to mind: a) iterating backwards...
7
by: Dave Hansen | last post by:
OK, first, I don't often have the time to read this group, so apologies if this is a FAQ, though I couldn't find anything at python.org. Second, this isn't my code. I wouldn't do this. But a...
6
by: Gustaf Liljegren | last post by:
I ran into this problem today: I got an array with Account objects. I need to iterate through this array to supplement the accounts in the array with more data. But the compiler complains when I...
2
by: Nick | last post by:
Hi all, Just a quick question. I have a class that exposes a number of fields (which are themselves custom types) through public properties. At run time, I have an object whom I'd like to...
1
by: redryderridesagain | last post by:
Using the Microsoft VBScript Regular Expressions 5.5 library in MS-Access VBA 6.3. I understand why the code below finds an occurance of the string "PC: blah blah blah A: BBB aaa B: BBB bbb C:...
0
by: deathtospam | last post by:
I have a value, retrieved from a recordset, that contains any number of hyperlinks to a number. For example: <a href="123456">Hi</a<a href='334455'>Hola</a> What I need to do is parse the...
2
by: MarkAurit | last post by:
Ive been using arraylists in 1.1 to return collections of custom business objects, and thoroughly enjoyed their simple programming style. After hearing of the advantages of generics during a 2.0...
5
by: Alan | last post by:
I was wondering whether it is good programming practice or asking for trouble to modify a vector while iterating through it. That is, I want to do something like the following pseudocode in C++: ...
2
by: =?Utf-8?B?U2hhcm9u?= | last post by:
I'm using a Bitmap that has a palette of 256 colors (256 bytes). I'm taking the Bitmap data by: System.Drawing.Imaging.BitmapData refData = myBitmap.LockBits(new Rectangle(0, 0, bmp.Width,...
4
RMWChaos
by: RMWChaos | last post by:
The next episode in the continuing saga of trying to develop a modular, automated DOM create and remove script asks the question, "Where should I put this code?" Alright, here's the story: with a...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.