Page Menu
Home
Phabricator (Chris)
Search
Configure Global Search
Log In
Files
F126915
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Authored By
Unknown
Size
702 B
Referenced Files
None
Subscribers
None
View Options
diff --git a/util/regex.cpp b/util/regex.cpp
index 1748a128..33aa6706 100644
--- a/util/regex.cpp
+++ b/util/regex.cpp
@@ -1,8 +1,17 @@
#include <string>
+/* gnu/posix's regex header */
+#include <regex.h>
+/* our regex header */
#include "regex.h"
using namespace std;
-bool Util::matchRegex(const string & str, const string & regex){
- return false;
+/* http://www.gnu.org/s/libc/manual/html_node/Regular-Expressions.html */
+bool Util::matchRegex(const string & str, const string & pattern){
+ regex_t regex;
+ if (regcomp(®ex, pattern.c_str(), 0) != 0){
+ return false;
+ }
+ bool matched = regexec(®ex, str.c_str(), 0, NULL, 0) == 0;
+ return matched;
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Jun 11, 1:34 PM (3 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
69271
Default Alt Text
(702 B)
Attached To
Mode
R75 R-Tech1
Attached
Detach File
Event Timeline