#include <iostream>
#include <string>
#include <regex>
int main( )
{
std:: string input = "+10.7% Is My String +5 And Some Extra Stuff Here" ;
std:: regex rx( "\\ +([0-9]+)\\ .([0-9]+)% Is My String \\ +([0-9]+) And Some Extra Stuff Here" ) ;
std:: smatch match;
if ( std:: regex_match ( input, match, rx) )
{
for ( std:: size_t i = 0 ; i < match.size ( ) ; ++ i)
{
std:: ssub_match sub_match = match[ i] ;
std:: string num = sub_match.str ( ) ;
std:: cout << " submatch " << i << ": " << num << std:: endl ;
std:: cout << " match str " << i << ": " << match[ i] .str ( ) << std:: endl ;
}
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8cmVnZXg+CiAKaW50IG1haW4oKQp7CiAgICBzdGQ6OnN0cmluZyBpbnB1dCA9ICIrMTAuNyUgSXMgTXkgU3RyaW5nICs1IEFuZCBTb21lIEV4dHJhIFN0dWZmIEhlcmUiOwogICAgc3RkOjpyZWdleCByeCgiXFwrKFswLTldKylcXC4oWzAtOV0rKSUgSXMgTXkgU3RyaW5nIFxcKyhbMC05XSspIEFuZCBTb21lIEV4dHJhIFN0dWZmIEhlcmUiKTsKCiAgICBzdGQ6OnNtYXRjaCBtYXRjaDsKCiAgICBpZiAoc3RkOjpyZWdleF9tYXRjaChpbnB1dCwgbWF0Y2gsIHJ4KSkKICAgIHsKICAgICAgICBmb3IgKHN0ZDo6c2l6ZV90IGkgPSAwOyBpIDwgbWF0Y2guc2l6ZSgpOyArK2kpCiAgICAgICAgewogICAgICAgICAgICBzdGQ6OnNzdWJfbWF0Y2ggc3ViX21hdGNoID0gbWF0Y2hbaV07CiAgICAgICAgICAgIHN0ZDo6c3RyaW5nIG51bSA9IHN1Yl9tYXRjaC5zdHIoKTsKICAgICAgICAgICAgc3RkOjpjb3V0IDw8ICIgc3VibWF0Y2ggIiA8PCBpIDw8ICI6ICIgPDwgbnVtIDw8IHN0ZDo6ZW5kbDsKICAgICAgICAgICAgc3RkOjpjb3V0IDw8ICIgbWF0Y2ggc3RyICIgPDwgaSA8PCAiOiAiIDw8IG1hdGNoW2ldLnN0cigpIDw8IHN0ZDo6ZW5kbDsKICAgICAgICB9ICAgCiAgICB9Cn0=