#include <iostream>
#include <regex>
using namespace std;
void show_matches(const std::string& in, const std::string& re)
{
std::smatch m;
std::regex_search(in, m, std::regex(re));
if (!m.empty())
{
std::cout << "input=[" << in << "], regex=[" << re << "]\n "
"prefix=[" << m.prefix() << "]\n smatch: ";
for (std::size_t n = 0; n < m.size(); ++n)
std::cout << "m[" << n << "]=[" << m[n] << "] ";
std::cout << "\n suffix=[" << m.suffix() << "]\n";
}
else
std::cout << "input=[" << in << "], regex=[" << re << "]: NO MATCH\n";
}
void setup() {
// put your setup code here, to run once:
Serial.begin(115200);
Serial.println("Hello, ESP32!");
char str[] = "annex32_1.47.5";
if(regex_search(str,regex("annex")))
Serial.println("match");
else
Serial.println("not match");
show_matches("abcdefghi", "a[a-z]{2,4}");
String pippo = "azazzerellabis";
show_matches(pippo.c_str(), "gg(azaz)(zere)");
}
void loop() {
// put your main code here, to run repeatedly:
delay(10); // this speeds up the simulation
}