#include <iostream>
#include <regex>
using namespace std;
string data = "Pi is equal to 3.14";
string pattern = R"(\d+\.\d+)";
regex regex(pattern);
smatch match;
if (regex_search(data, match, regex)) {
float pi = stof(match[0]);
//pi is 3.14
cout << "pi is " << pi;
}