RegexUtils.cpp 601 B

123456789101112131415161718192021
  1. /*
  2. * Author: Patrick-Christopher Mattulat
  3. * Company: Lynar Studios
  4. * E-Mail: webmaster@lynarstudios.com
  5. * Created: 2023-02-04
  6. * Changed: 2023-02-04
  7. *
  8. * */
  9. #include <ls-std/core/utils/RegexUtils.hpp>
  10. #include <regex>
  11. ls::std::core::RegexUtils::RegexUtils() = default;
  12. ls::std::core::RegexUtils::~RegexUtils() = default;
  13. ::std::string ls::std::core::RegexUtils::escapeString(const ::std::string &_text)
  14. {
  15. static ::std::regex regexMetaEscape(R"(([\^\$\\\.\*\+\?\(\)\[\]\{\}\|]))");
  16. return ::std::regex_replace(_text, regexMetaEscape, R"(\$1)");
  17. }