Home » Community » Newbie corner » Problem with RegExp, I don't understand it (\w+)
Problem with RegExp, I don't understand it (\w+) [message #59796] |
Tue, 18 April 2023 21:11 |
mx12
Messages: 3 Registered: September 2021 Location: Russia
|
Junior Member |
|
|
Hi, please help with it
Expression"(\w+)" don't select groups. This expression select only first entrance ("DEL_MARK").
It should look like this, what problem? :
DEL_MARK, ENABLED, NAME_RU, R, G, B, HTML1, CMYK"
Thanks I need your advice!
My code:
void sql2array::GenerateResult()
{
// DEBUG {
ileInput.Clear();
ileInput.Append("INSERT INTO DAT_COLORS (DEL_MARK, ENABLED, NAME_RU, R, G, B, HTML1, CMYK)");
// }
if(ileInput.GetLineCount() > 0
&& ileInput.GetLineLength(0) > 0){
//
RegExp r0("^(insert)", RegExp::CASELESS);
if(r0.Match(ileInput.GetUtf8Line(0))){
RegExp r1("(?<=\\()(.*)(?<!\\))", RegExp::UNICODE);
if(r1.GlobalMatch(ileInput.GetUtf8Line(0))){
PromptOK(r1[0]); // DBG
RegExp r2("(\\w+)");
/*RegExp r2;
r2.SetPattern("(\\w+)");
*/
if(r2.GlobalMatch(r1[0])){
String s;
s << r2.GetCount() << ": | "; // DBG
for(int i = 0; i < r2.GetCount(); i++){
s << r2[i] << " | "; // DBG
}
PromptOK(s);
}
else if(r0.IsError())
PromptOK(Format("%s", r2.GetError()));
else
PromptOK("A possible combination has not been found (groups)");
}
else if(r0.IsError())
PromptOK(Format("%s", r1.GetError()));
else
PromptOK("A possible combination has not been found");
}
else if(r0.IsError()){
PromptOK(Format("%s", r0.GetError()));
}
else
PromptOK("The entered code should begin with the keyword INSERT");
}
else
PromptOK("Enter the text in the left field");
}
|
|
|
Goto Forum:
Current Time: Tue Apr 29 10:03:23 CEST 2025
Total time taken to generate the page: 0.00495 seconds
|