Автор Carole console задал вопрос в разделе Другие языки и технологии
пример использование regex в C/C++ и получил лучший ответ
Ответ от Ra[гуру]
stl (C++11): #include <iostream> #include <fstream> #include <string> #include <regex> using namespace std; int main() { fstream in(\"file.txt\"); regex r(\"^[1]+[\\\\D|\\\\d]*$\"); string s; while (in) { getline(in, s); if ( regex_match(s, r) ) cout << s << endl; } return 0; } boost: #include <iostream> #include <fstream> #include <string> #include <boost/regex.hpp> using namespace std; int main() { fstream in(\"file.txt\"); boost::regex r(\"^[1]+[\\\\D|\\\\d]*$\"); string s; while (in) { getline(in, s); if ( boost::regex_match(s, r) ) cout << s << endl; } return 0; } ЗЫ: не знаю регулярки, поэтому просто взял выражение у ответчика выше
^[1]+[D|d]*$
^[1]+[D|d]*$