fork(7) download
  1. #include <iostream>
  2. #include <regex>
  3. using namespace std;
  4.  
  5. int main() {
  6. const std::regex pattern("[^a-zA-Z0-9.-_]");
  7. std::string String = "!#!e-ma.il@boomer.com";
  8. // std::regex_constants::icase
  9. // std::string newtext = std::regex_replace( String, pattern, "X", std::regex_constants::format_first_only );
  10. std::string newtext = std::regex_replace( String, pattern, "", std::regex_constants::icase);
  11. std::cout << newtext << std::endl;
  12. return 0;
  13. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:10:92: error: no matching function for call to ‘regex_replace(std::__cxx11::string&, const regex&, const char [1], const std::regex_constants::syntax_option_type&)’
  std::string newtext = std::regex_replace( String, pattern, "", std::regex_constants::icase);
                                                                                            ^
In file included from /usr/include/c++/6/regex:62:0,
                 from prog.cpp:2:
/usr/include/c++/6/bits/regex.h:2294:5: note: candidate: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type, class _St, class _Sa> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&, const std::__cxx11::basic_string<_Ch_type, _St, _Sa>&, std::regex_constants::match_flag_type)
     regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
     ^~~~~~~~~~~~~
/usr/include/c++/6/bits/regex.h:2294:5: note:   template argument deduction/substitution failed:
prog.cpp:10:92: note:   deduced conflicting types for parameter ‘_Bi_iter’ (‘std::__cxx11::basic_regex<char>’ and ‘const char*’)
  std::string newtext = std::regex_replace( String, pattern, "", std::regex_constants::icase);
                                                                                            ^
In file included from /usr/include/c++/6/bits/regex.h:2802:0,
                 from /usr/include/c++/6/regex:62,
                 from prog.cpp:2:
/usr/include/c++/6/bits/regex.tcc:459:5: note: candidate: template<class _Out_iter, class _Bi_iter, class _Rx_traits, class _Ch_type> _Out_iter std::regex_replace(_Out_iter, _Bi_iter, _Bi_iter, const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, std::regex_constants::match_flag_type)
     regex_replace(_Out_iter __out, _Bi_iter __first, _Bi_iter __last,
     ^~~~~~~~~~~~~
/usr/include/c++/6/bits/regex.tcc:459:5: note:   template argument deduction/substitution failed:
prog.cpp:10:92: note:   deduced conflicting types for parameter ‘_Bi_iter’ (‘std::__cxx11::basic_regex<char>’ and ‘const char*’)
  std::string newtext = std::regex_replace( String, pattern, "", std::regex_constants::icase);
                                                                                            ^
In file included from /usr/include/c++/6/regex:62:0,
                 from prog.cpp:2:
/usr/include/c++/6/bits/regex.h:2339:5: note: candidate: template<class _Rx_traits, class _Ch_type, class _St, class _Sa, class _Fst, class _Fsa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const std::__cxx11::basic_string<_Ch_type, _St, _Sa>&, const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&, const std::__cxx11::basic_string<_Ch_type, _Fst, _Fsa>&, std::regex_constants::match_flag_type)
     regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s,
     ^~~~~~~~~~~~~
/usr/include/c++/6/bits/regex.h:2339:5: note:   template argument deduction/substitution failed:
prog.cpp:10:92: note:   mismatched types ‘const std::__cxx11::basic_string<_Ch_type, _Fst, _Fsa>’ and ‘const char [1]’
  std::string newtext = std::regex_replace( String, pattern, "", std::regex_constants::icase);
                                                                                            ^
In file included from /usr/include/c++/6/regex:62:0,
                 from prog.cpp:2:
/usr/include/c++/6/bits/regex.h:2365:5: note: candidate: template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type, _St, _Sa> std::regex_replace(const std::__cxx11::basic_string<_Ch_type, _St, _Sa>&, const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, std::regex_constants::match_flag_type)
     regex_replace(const basic_string<_Ch_type, _St, _Sa>& __s,
     ^~~~~~~~~~~~~
/usr/include/c++/6/bits/regex.h:2365:5: note:   template argument deduction/substitution failed:
prog.cpp:10:92: note:   cannot convert ‘std::regex_constants::icase’ (type ‘const std::regex_constants::syntax_option_type’) to type ‘std::regex_constants::match_flag_type’
  std::string newtext = std::regex_replace( String, pattern, "", std::regex_constants::icase);
                                                                                            ^
In file included from /usr/include/c++/6/regex:62:0,
                 from prog.cpp:2:
/usr/include/c++/6/bits/regex.h:2391:5: note: candidate: template<class _Rx_traits, class _Ch_type, class _St, class _Sa> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&, const std::__cxx11::basic_string<_Ch_type, _St, _Sa>&, std::regex_constants::match_flag_type)
     regex_replace(const _Ch_type* __s,
     ^~~~~~~~~~~~~
/usr/include/c++/6/bits/regex.h:2391:5: note:   template argument deduction/substitution failed:
prog.cpp:10:92: note:   mismatched types ‘const _Ch_type*’ and ‘std::__cxx11::basic_string<char>’
  std::string newtext = std::regex_replace( String, pattern, "", std::regex_constants::icase);
                                                                                            ^
In file included from /usr/include/c++/6/regex:62:0,
                 from prog.cpp:2:
/usr/include/c++/6/bits/regex.h:2417:5: note: candidate: template<class _Rx_traits, class _Ch_type> std::__cxx11::basic_string<_Ch_type> std::regex_replace(const _Ch_type*, const std::__cxx11::basic_regex<_Ch_type, _Rx_traits>&, const _Ch_type*, std::regex_constants::match_flag_type)
     regex_replace(const _Ch_type* __s,
     ^~~~~~~~~~~~~
/usr/include/c++/6/bits/regex.h:2417:5: note:   template argument deduction/substitution failed:
prog.cpp:10:92: note:   mismatched types ‘const _Ch_type*’ and ‘std::__cxx11::basic_string<char>’
  std::string newtext = std::regex_replace( String, pattern, "", std::regex_constants::icase);
                                                                                            ^
stdout
Standard output is empty