I need to match a string of any characters escaping forward slashes by backslash.
Some examples (in c++ string you need twice more backslashes then in the exmaples):
sdfsdfkjl/sdf // does not match
sdfsdfkj\/sdf // does match
sdfsdfk\\/sdf // does not match
sdfsdf\\\/sdf // does match
sdfsdfk\\/sd\\\/f // does not match
sdfsdf\\\/sdf\\\/f // does match
// and so on
I suppose there should be something like this
std::regex const regEx(
"((?:(?:(?!\\\\)\\\\/)|(?:(?:\\\\\\\\)+\\\\/)|(?:[^/]))*)");
But it does not work for some reasons. My guess is that it is related to lookahead operation.
Aucun commentaire:
Enregistrer un commentaire