hanickadot / compile-time-regular-expressions

Compile Time Regular Expression in C++
https://twitter.com/hankadusikova
Apache License 2.0
3.22k stars 177 forks source link

Non-ending split for adding anchors. #297

Open Extra-Creativity opened 8 months ago

Extra-Creativity commented 8 months ago

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;
    }
}