I'm trying to construct a regular expression to treat delimited speech marks (\"
) as a single character.
The following code compiles fine, but terminates on trying to initialise rgx, throwing the error Abort trap: 6
using libc++.
std::regex rgx("[[.\\\\\".]]");
std::smatch results;
std::string test_str("\\\"");
std::regex_search(test_str, results, rgx);
If I remove the [[. .]]
, it runs fine, results[0]
returning \"
as intended, but as said, I'd like for this sequence to be usable as a character class.
Edit: Ok, I realise now that my previous understanding of collated sequences was incorrect, and the reason it wouldn't work is that \\\\\"
is not defined as a sequence. So my new question: is it possible to define collated sequences?