#include <iostream>
#include <string>
#include <regex>
int main()
{
std::string input = "led=1,vid=2,fc=333,ts=4444";
std::regex rx("led\\=([0-9]+)\\,vid\\=([0-9]+)\\,fc\\=([0-9]+)\\,ts\\=([0-9]+)");
std::smatch match;
if (std::regex_match(input, match, rx))
{
std::cout << "match size " << match.size() << std::endl;
std::cout << "led " << match[1].str() << std::endl;
std::cout << "vid " << match[2].str() << std::endl;
std::cout << "fc " << match[3].str() << std::endl;
std::cout << "ts " << match[4].str() << std::endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8cmVnZXg+CiAKaW50IG1haW4oKQp7CiAgICBzdGQ6OnN0cmluZyBpbnB1dCA9ICJsZWQ9MSx2aWQ9MixmYz0zMzMsdHM9NDQ0NCI7CiAgICBzdGQ6OnJlZ2V4IHJ4KCJsZWRcXD0oWzAtOV0rKVxcLHZpZFxcPShbMC05XSspXFwsZmNcXD0oWzAtOV0rKVxcLHRzXFw9KFswLTldKykiKTsKCiAgICBzdGQ6OnNtYXRjaCBtYXRjaDsKCiAgICBpZiAoc3RkOjpyZWdleF9tYXRjaChpbnB1dCwgbWF0Y2gsIHJ4KSkKICAgIHsKICAgICAgICBzdGQ6OmNvdXQgPDwgIm1hdGNoIHNpemUgIiA8PCBtYXRjaC5zaXplKCkgPDwgc3RkOjplbmRsOwogICAgICAgIHN0ZDo6Y291dCA8PCAibGVkICIgPDwgbWF0Y2hbMV0uc3RyKCkgPDwgc3RkOjplbmRsOwogICAgICAgIHN0ZDo6Y291dCA8PCAidmlkICIgPDwgbWF0Y2hbMl0uc3RyKCkgPDwgc3RkOjplbmRsOwogICAgICAgIHN0ZDo6Y291dCA8PCAiZmMgIiA8PCBtYXRjaFszXS5zdHIoKSA8PCBzdGQ6OmVuZGw7CiAgICAgICAgc3RkOjpjb3V0IDw8ICJ0cyAiIDw8IG1hdGNoWzRdLnN0cigpIDw8IHN0ZDo6ZW5kbDsKICAgIH0KfQ==