diff options
Diffstat (limited to 'src/modules/extra/m_regex_pcre.cpp')
-rw-r--r-- | src/modules/extra/m_regex_pcre.cpp | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/src/modules/extra/m_regex_pcre.cpp b/src/modules/extra/m_regex_pcre.cpp index 04b9da0ab..91c2d1404 100644 --- a/src/modules/extra/m_regex_pcre.cpp +++ b/src/modules/extra/m_regex_pcre.cpp @@ -29,15 +29,6 @@ # pragma comment(lib, "libpcre.lib") #endif -class PCREException : public ModuleException -{ - public: - PCREException(const std::string& rx, const std::string& error, int erroffset) - : ModuleException("Error in regex " + rx + " at offset " + ConvToStr(erroffset) + ": " + error) - { - } -}; - class PCRERegex : public Regex { pcre* regex; @@ -51,7 +42,7 @@ class PCRERegex : public Regex if (!regex) { ServerInstance->Logs->Log(MODNAME, LOG_DEBUG, "pcre_compile failed: /%s/ [%d] %s", rx.c_str(), erroffset, error); - throw PCREException(rx, error, erroffset); + throw RegexException(rx, error, erroffset); } } @@ -60,14 +51,9 @@ class PCRERegex : public Regex pcre_free(regex); } - bool Matches(const std::string& text) + bool Matches(const std::string& text) CXX11_OVERRIDE { - if (pcre_exec(regex, NULL, text.c_str(), text.length(), 0, 0, NULL, 0) > -1) - { - // Bang. :D - return true; - } - return false; + return (pcre_exec(regex, NULL, text.c_str(), text.length(), 0, 0, NULL, 0) >= 0); } }; @@ -75,7 +61,7 @@ class PCREFactory : public RegexFactory { public: PCREFactory(Module* m) : RegexFactory(m, "regex/pcre") {} - Regex* Create(const std::string& expr) + Regex* Create(const std::string& expr) CXX11_OVERRIDE { return new PCRERegex(expr); } |