I have the following code using the compile time regular expressions library:
constexpr auto pattern = ctll::fixed_string{ "\d+|(?<=FLAGS ).*?\)|(?<=Subject: ).*?(?=rn)|(?<=From: ).*?(?=rn)|(?<=To: ).*?(?=rn)|(?<=Date: ).*?(?=rn)" };
auto all_matches = ctre::search_all<pattern>(header);
for (const auto& match : all_matches)
{
auto num_matches = match.count();
auto m0 = match.get<0>().to_string();
std::cout << m0 << std::endl;
}
I have the following input string:
* 9999 FETCH (UID 1000 RFC822.SIZE 9393939 FLAGS (Seen) BODY[HEADER.FIELDS (From To Subject Date)] {132}rnDate: Tue, 20 Feb 2024 02:28:43 -0800rnSubject: rnFrom: Eshy <[email protected]>rnTo: Eshy <[email protected]>rnrn)
The Subject:
portion of the input string is empty. This causes ctre to fail as it cannot move past that point. The same string in regex101, however, has no issue. Is there a solution to this?