compile-time-regular-expressions icon indicating copy to clipboard operation
compile-time-regular-expressions copied to clipboard

Non-ending split for adding anchors.

Open Extra-Creativity opened this issue 2 years ago • 0 comments
trafficstars

I notice issue 296, and add anchors on regex. Though it's stupid because it definitely won't split anything, it may be expected to be an empty range instead of an infinite loop.

#include <iostream>
#include <ctre.hpp>

int main() {
    std::string data = "a\n\nb\n";
    auto lines = ctre::split<"^\n$">(data);
    for (auto line: lines) {
        auto t = line.to_string();
        std::cout << ">" << t << "<" << std::endl;
    }
}

Extra-Creativity avatar Oct 14 '23 12:10 Extra-Creativity