Qt doesn't require double backslashes, it's the C++ compiler that requires the double backslashes in quoted strings. If you are getting the string from user input or reading from a file, double backslashes are not required. This example reads the string from the file:
Where the test.txt file contains:Qt Code:
f.close(); QRegularExpression re("\\/(?<!\\\\\\/)");To copy to clipboard, switch view to plain text mode
hello/world/how\/are/you
This should be the same if your text is coming from a QLineEdit, etc.




Reply With Quote
Bookmarks