#include <regex>
#include <string>
#include <iostream>
using namespace std;
int main()
{
std::string pat = "^\\s*" // optional whitespace at the start, then
"([-+]?)" // an optional sign, then
"(?=\\.?\\d)" // lookahead for digit or .digit
"(\\d*)" // numerator (possibly empty)
"(?:" // followed by
"(?:/(\\d+))?" // an optional denominator
"|" // or
"(?:\\.(\\d*))?" // an optional fractional part
"(?:E([-+]?\\d+))?" // and optional exponent
")"
"\\s*$"; // and optional whitespace to finish
std::regex e(pat);
std::string s(" -23/34 ");
std::smatch a;
if (std::regex_search(s, a, e))
std::cout << a[0] << endl;
}
I2luY2x1ZGUgPHJlZ2V4PgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8aW9zdHJlYW0+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CgppbnQgbWFpbigpCnsKCXN0ZDo6c3RyaW5nIHBhdCA9ICJeXFxzKiIgIC8vIG9wdGlvbmFsIHdoaXRlc3BhY2UgYXQgdGhlIHN0YXJ0LCB0aGVuCgkJIihbLStdPykiICAgICAgICAgICAgICAvLyBhbiBvcHRpb25hbCBzaWduLCB0aGVuCgkJIig/PVxcLj9cXGQpIiAgICAgICAgICAvLyBsb29rYWhlYWQgZm9yIGRpZ2l0IG9yIC5kaWdpdAoJCSIoXFxkKikiICAgICAgICAgICAgICAgLy8gbnVtZXJhdG9yIChwb3NzaWJseSBlbXB0eSkKCQkiKD86IiAgICAgICAgICAgICAgICAgIC8vIGZvbGxvd2VkIGJ5CgkJICAgIig/Oi8oXFxkKykpPyIgICAgICAvLyBhbiBvcHRpb25hbCBkZW5vbWluYXRvcgoJCSJ8IiAgICAgICAgICAgICAgICAgICAgLy8gb3IKCQkgICAiKD86XFwuKFxcZCopKT8iICAgIC8vIGFuIG9wdGlvbmFsIGZyYWN0aW9uYWwgcGFydAoJCSAgICIoPzpFKFstK10/XFxkKykpPyIgLy8gYW5kIG9wdGlvbmFsIGV4cG9uZW50CgkJIikiCgkJIlxccyokIjsgICAgICAgICAgICAgICAvLyAgYW5kIG9wdGlvbmFsIHdoaXRlc3BhY2UgdG8gZmluaXNoCglzdGQ6OnJlZ2V4IGUocGF0KTsKCXN0ZDo6c3RyaW5nIHMoIiAtMjMvMzQgIik7CglzdGQ6OnNtYXRjaCBhOwoJaWYgKHN0ZDo6cmVnZXhfc2VhcmNoKHMsIGEsIGUpKQogICAgCXN0ZDo6Y291dCA8PCBhWzBdIDw8IGVuZGw7Cgp9