I'd like to trim left/right the input_string before passing it to regex_match in the if statement and I've unsuccessfully tried the boost trim_right and trim_left, not sure how to solve it though.
How do I simply trim the inputs so that the first two inputs "  0  " and "  0.1  " would become valid numbers?
#include <string>
#include <boost/algorithm/string.hpp>
#include <iostream>
#include <regex>
#include <vector>
using namespace std;
int main() {
    vector<string> string_vector = {"   0  ","   0.1   ","abc","1 a","2e10","-90e3","1e","e3","6e-1","99e2.5","53.5e93","--6","-+3","95a54e53"};
    regex expression_two("^[+-]?(?:[0-9]*\\.[0-9]+|[0-9]+\\.[0-9]*|[0-9]+)[Ee][+-]?[0-9]+$|^[+-]?(?:[0-9]*\\.[0-9]+|[0-9]+\\.[0-9]*|[0-9]+)$|^[+-]?[0-9]+$");
    for (const auto &input_string: string_vector) {
        if (std::regex_match(input_string, expression_two))
            cout << "[0-9] Char Class: '" << input_string << "' is a valid number." << endl;
    }
    return 0;
}
Current Output
[0-9] Char Class: '2e10' is a valid number.
[0-9] Char Class: '-90e3' is a valid number.
[0-9] Char Class: '6e-1' is a valid number.
[0-9] Char Class: '53.5e93' is a valid number.
Desired Output
[0-9] Char Class: '  0  ' is a valid number.
[0-9] Char Class: '  0.1  ' is a valid number.
[0-9] Char Class: '2e10' is a valid number.
[0-9] Char Class: '-90e3' is a valid number.
[0-9] Char Class: '6e-1' is a valid number.
[0-9] Char Class: '53.5e93' is a valid number.
 
     
    