Unable to match/search using std::regex

I have the following Arduino sketch using regex but the matches and searches fail. I just do not know why,
This is a very trivial example but I wish to search in complex xml strings. I do not wish to use find and substr. It is so much neater with regex. Any help is very much appreciated

#include <Arduino.h>

void setup() {

std::string rl = “HTTP kjjkjk 200 kl”;
std::regex rex("^HTTP");
std::smatch bmatch;
if (std::regex_search(rl, bmatch, rex)) {
Serial.print("found match1 "); Serial.println(bmatch.size());
Serial.print("Searched for HTTP. Search = "); Serial.println( std::regex_search(rl, rex));

std::smatch cmatch;
std::regex rexkk("^.(200).");
if (std::regex_match(rl, cmatch, rexkk)) {
Serial.print("found match2 "); Serial.println(cmatch.size());
Serial.print("Matched for “^.(200).” Match = "); Serial.println( std::regex_match(rl, rexkk));

void loop() {
// put your main code here, to run repeatedly:


Searched for HTTP. Search = 0
Matched for “^.(200).” Match = 0

#include <regex>
#include <string>

Does this compile ?
Which Arduino board are you using ?

Don't use RegEx to parse XML.

That being said, it is strange that your code doesn't work. Your toolchain's STL might not be configured correctly. What board/core are you using?


This does compile OK. I am using the latest Arduino IDE. The board is the ESP8266