+
+substring String::operator()(const regex &r)
+{
+ substring sub;
+ regmatch_t match;
+
+ sub.str = this;
+ sub.start = 0;
+ sub.len = 0;
+
+ if (regexec(&r.expression, p->s, 1, &match, 0) == 0)
+ {
+ sub.start = match.rm_so;
+ sub.len = match.rm_eo - match.rm_so;
+ }
+
+ return sub;
+}
+