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

C / C++ / MFC

 
GeneralRe: C++ reflection Pin
jschell17-Nov-23 5:32
jschell17-Nov-23 5:32 
GeneralRe: C++ reflection Pin
honey the codewitch17-Nov-23 5:34
mvahoney the codewitch17-Nov-23 5:34 
GeneralRe: C++ reflection Pin
jschell20-Nov-23 7:17
jschell20-Nov-23 7:17 
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 
Since my last post is nowhere to be found here...
I do appreciate all help resolving the issue.

And since posting code was requested, here it is.
It generally works retrieving multiple matches...
such as "hci1 hci0 "
what is missing is to retrieve PAIR of matches
such as
"hci1 00:xx:yy...
in other words I can retrieve name or address but not BOTH.

I would be grateful if somebody can give me the actual code and explanation how to match PAIR of values.

As can be seen - I did try different placement of parentheses
" (...)" but it did not work.







C++
{// global matching code block

                    text = " START MATCH NAME AND ADDRESS CODE BLOCK ";
                    textEditPtr_DEBUG->append(text);

#ifdef TASK
              DELETED 
#endif

                    QString word;
                    QStringList words;
                    QString pattern = "Devices:\n\thci1\t00:50:B6:80:4D:5D\n\thci0\t00:15:83:15:A2:CB\n";
                    //QRegularExpression re("(\\w+)");
                    //QRegularExpression re("([0-F]{2}[:-]){5})");
                    //QRegularExpression re("([0-F]{2}[:])"); // match xx:
                    //QRegularExpression re("(([0-F]{2}[:]){5}[0-F]{2})"); // TOK match full BOTH addressxx:
                    // QRegularExpression re("((hci[0-9])(([0-F]{2}[:]){5}[0-F]{2}))"); NO GO 
                    //QRegularExpression re("(hci[0-9])"); TOK
                    QRegularExpression re("(([0-F]{2}[:]){5}[0-F]{2})");
                    QRegularExpressionMatchIterator i = re.globalMatch(pattern);
               
                    text = " HAS MATCH MULTI";
                    qDebug()<< text;

                    textEditPtr_DEBUG->append(text);
#ifdef BYPASS no go
                    foreach(auto item,i)
                    {
                    text = " TEST foreach ";
                    text += item;
                    qDebug()<< text;

                    textEditPtr_DEBUG->append(text);
                    }

#endif
                    while (i.hasNext()) {
                    QRegularExpressionMatch match = i.next();
                    word = match.captured(1);
                    words << word;
                    qDebug()<< word;

                    text =  " Full match name and address...  ";
                    text += word;
                    qDebug()<< text;

                    textEditPtr_DEBUG->append(text);
                    //}
                    }
#ifdef BYPASS
                    else
                    {
                    text = " NO MATCH  MULTI";
                    }
#endif
                    qDebug()<< text;

                    text = " END MATCH ADDRESS CODE BLOCK ";
                    textEditPtr_DEBUG->append(text);

                }

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 
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 

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.