15 static const char *underline =
16 "----------------------------------------------------------------\n";
22 printf(
"Global matching\n%s", underline);
29 printf(
"Global matching with back-refs\n%s", underline);
36 printf(
"Matching with nested back-refs\n%s", underline);
37 TPMERegexp re2(
"([\\w\\.-]+)@((\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+))");
38 TString m2(
"matevz.tadel@137.138.170.210");
48 printf(
"Split\n%s", underline);
50 TString m(
"root:x:0:0:root:/root:/bin/bash");
55 printf(
"Split with maxfields=5\n%s", underline);
60 printf(
"Split with empty elements in the middle and at the end\n"
61 "maxfields=0, so trailing empty elements are dropped\n%s", underline);
62 m =
"root::0:0:root:/root::";
67 printf(
"Split with empty elements at the beginning and end\n"
68 "maxfields=-1, so trailing empty elements are kept\n%s", underline);
74 printf(
"Split with no pattern in string\n%s", underline);
75 m =
"A dummy line of text.";
82 printf(
"Split with regexp potentially matching a null string \n%s", underline);
91 printf(
"Split on patteren with back-refs\n%s", underline);
103 printf(
"Substitute\n%s", underline);
104 TPMERegexp re(
"(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)");
109 printf(
"Substitute '%s','%s' => '%s'\n",
m.Data(),
r.Data(),
s.Data());
114 printf(
"Global substitute\n%s", underline);
115 TPMERegexp re(
"(\\w+)\\.(\\w+)@[\\w\\.-]+",
"g");
116 TString m(
"rene.brun@cern.ch, philippe.canal@fnal.gov, fons.rademakers@cern.ch");
120 printf(
"Substitute '%s','%s' => '%s'\n",
m.Data(),
r.Data(),
s.Data());
Wrapper for PCRE library (Perl Compatible Regular Expressions).
static constexpr double s
static constexpr double m2