Click here to Skip to main content
15,887,027 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to "match" multiple occurrences of item in text ? ( Regular expression ) Pin
Salvatore Terress12-Nov-23 6:40
Salvatore Terress12-Nov-23 6:40 
AnswerRe: How to "match" multiple occurrences of item in text ? ( Regular expression ) Pin
Richard MacCutchan12-Nov-23 21:52
mveRichard MacCutchan12-Nov-23 21:52 
QuestionRe: How to "match" multiple occurrences of item in text ? ( Regular expression ) Pin
CPallini12-Nov-23 23:05
mveCPallini12-Nov-23 23:05 
AnswerRe: How to "match" multiple occurrences of item in text ? ( Regular expression ) Pin
jschell13-Nov-23 6:33
jschell13-Nov-23 6:33 
GeneralRe: How to "match" multiple occurrences of item in text ? ( Regular expression ) Pin
Salvatore Terress14-Nov-23 6:41
Salvatore Terress14-Nov-23 6:41 
AnswerRe: How to "match" multiple occurrences of item in text ? ( Regular expression ) Pin
jschell14-Nov-23 7:46
jschell14-Nov-23 7:46 
GeneralRe: How to "match" multiple occurrences of item in text ? ( Regular expression ) Pin
Salvatore Terress14-Nov-23 11:52
Salvatore Terress14-Nov-23 11:52 
GeneralRe: How to "match" multiple occurrences of item in text ? ( Regular expression ) Pin
jschell15-Nov-23 3:22
jschell15-Nov-23 3:22 
When you post code use code blocks.

Salvatore Terress wrote:
If I opt to use QRegularExpressionMatchIterator i = re.globalMatch(pattern);


Not sure how to emphasize what I have already said several times.

That question is NOT about regular expressions.

It is about how to use that specific library.

I suggest you start with a less difficult example to figure out how iteration works. And google for examples as I documented in the other reply.


Salvatore Terress wrote:
There should be at lest three "code groups " delimited by "(,,,code group... )"


You mean the parens. Parens are used for 'capturing' and for 'grouping'.

For the case I gave the inner ones was to group the outer for capturing.

And yes that is a problem when you iterate. The library you are using might have a way to specify that the parens are not 'capturing'.

In Perl it looks like the following. There would be only one capturing group which would match either 'abcxyz' or 'defxyz'.

((?:abc|def)xyz)


I will note that I use that feature so rarely that I had to look it up.

Salvatore Terress wrote:
the analysis of "xx:"


As I mentioned there are variations to what I suggested. Myself I don't care for using '{2}' in a case like this. Just a preference.

(Had to edit the above because I messed up the code block)

modified 16-Nov-23 10:40am.

GeneralRe: How to "match" multiple occurrences of item in text ? ( Regular expression ) Pin
Salvatore Terress15-Nov-23 7:05
Salvatore Terress15-Nov-23 7:05 
QuestionHow do you pass an int by reference to a function? Pin
Calin Negru11-Nov-23 3:57
Calin Negru11-Nov-23 3:57 
AnswerRe: How do you pass an int by reference to a function? Pin
Greg Utas11-Nov-23 4:19
professionalGreg Utas11-Nov-23 4:19 
GeneralRe: How do you pass an int by reference to a function? Pin
Richard MacCutchan11-Nov-23 4:49
mveRichard MacCutchan11-Nov-23 4:49 
GeneralRe: How do you pass an int by reference to a function? Pin
Greg Utas11-Nov-23 5:40
professionalGreg Utas11-Nov-23 5:40 
GeneralRe: How do you pass an int by reference to a function? Pin
Richard MacCutchan11-Nov-23 6:09
mveRichard MacCutchan11-Nov-23 6:09 
GeneralRe: How do you pass an int by reference to a function? Pin
honey the codewitch15-Nov-23 4:38
mvahoney the codewitch15-Nov-23 4:38 
GeneralRe: How do you pass an int by reference to a function? Pin
Greg Utas15-Nov-23 5:15
professionalGreg Utas15-Nov-23 5:15 
GeneralRe: How do you pass an int by reference to a function? Pin
Calin Negru11-Nov-23 5:31
Calin Negru11-Nov-23 5:31 
QuestionStruct initalization valid ? Pin
Maximilien7-Nov-23 8:08
Maximilien7-Nov-23 8:08 
AnswerRe: Struct initalization valid ? Pin
Mircea Neacsu7-Nov-23 8:17
Mircea Neacsu7-Nov-23 8:17 
GeneralRe: Struct initalization valid ? Pin
Maximilien7-Nov-23 8:39
Maximilien7-Nov-23 8:39 
AnswerRe: Struct initalization valid ? Pin
markkuk7-Nov-23 11:48
markkuk7-Nov-23 11:48 
GeneralRe: Struct initalization valid ? Pin
Maximilien8-Nov-23 2:32
Maximilien8-Nov-23 2:32 
GeneralRe: Struct initalization valid ? Pin
CPallini8-Nov-23 2:37
mveCPallini8-Nov-23 2:37 
AnswerRe: Struct initalization valid ? Pin
jschell8-Nov-23 6:01
jschell8-Nov-23 6:01 
AnswerRe: Struct initalization valid ? Pin
honey the codewitch8-Nov-23 10:03
mvahoney the codewitch8-Nov-23 10:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.