0

I use the following statement to get the user string input in the console:

std::getline(std::cin, variable);

And it captures it. I then want to split the whole string by space, so I use the following regex rule"

std::string EachWord = "([a-zA-Z:/\\]+)"; // I also have used \: than :
regex reg_rule(this->cmdrepo.EachWord);
// and the rest of regex capturing

The problem is that, it captures everything, but does not capture :, and treats it as a space, so this string --setCurrent E://folder/ is split into:

1- setCurrent
2- E // instead, it should be E://folder

What should I do?

Mostafa Talebi
  • 8,825
  • 16
  • 61
  • 105

0 Answers0