[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Stephen Walch

10/30/2002 12:54:00 PM

I am using the following code to parse a string of name value pairs like
"name1=value1; name2=value2"

// Managed C++
Regex* r = new
Regex("(?<name>\\w+)=(?<value>(\\w[\\w\\s\\/\\-_\\.\\:\\\\=]*)?\\w)");
Match* m;
for (m = r->Match(m_sConnectionString); m->Success; m = m->NextMatch())
{
String* name = m->Groups->get_Item("name")->Value->ToLower();
String* value = m->Groups->get_Item("value")->Value;
}

Works ok, but when an illegal character is encountered in a name or value,
NextMatch() simply returns NULL as if it were at the end. How can I tell if
the matches I got represented the entire string or not?

Thanks!


1 Answer

(Jacob Yang)

11/10/2002 9:12:00 AM

0

Hi Stephen,

Since we can get the length of the string, we can check that if it is the
end of the string when Match.NextMatch() return null.

Best regards,

Jacob Yang
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2002 Microsoft Corporation. All rights
reserved