#include <iostream>
#include <regex>
#include <z/core/string.hpp>
int main() {
std::regex regex;
while (!std::cin.eof()) {
if (std::cin.eof() && !pattern.
length()) {
break;
}
try {
regex.assign(pattern.
str());
} catch (const std::regex_error &err) {
continue;
}
auto match = std::regex_search(text.
str(), regex);
if (std::regex_search(text.
str(), regex)) {
(text + " matches!").writeln(std::cout);
} else {
}
}
return 0;
}
A template class for character strings.
Definition string.hpp:62
std::string str() const noexcept
Convert to a std::string.
Definition string.hpp:1592
int length() const noexcept override
Get the character count of the string.
string & readln(std::istream &stream) noexcept
Read string data from a stream until a newline is encountered.
void write(std::ostream &stream) const noexcept
Write string data to a stream in that stream's encoding.
Definition string.hpp:1496
void writeln(std::ostream &stream) const noexcept
Write string data to a stream in its format, appending a newline.
Definition string.hpp:1507