1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 \*---------------------------------------------------------------------------*/
28 #include "IOstreams.H"
37 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
40 int main(int argc, char *argv[])
43 List<Tuple2<string, string> > rawList(IFstream("testRegexps")());
44 Info<< "input list:" << rawList << endl;
45 IOobject::writeDivider(Info) << endl;
50 forAll(rawList, elemI)
52 const string& pat = rawList[elemI].first();
53 const string& str = rawList[elemI].second();
56 Info<< str << " =~ m/" << pat.c_str() << "/ == ";
58 if (re.match(str, groups))
63 Info<< " groups:" << groups;
71 Info<< " partial match";
77 Info<<"test regExp(const char*) ..." << endl;
80 if (regExp("[Mm]ar[ck]").match(me))
82 Info<< "matched: " << me << endl;
86 Info<< "no match" << endl;
89 if (regExp("").match(me))
91 Info<< "matched: " << me << endl;
95 Info<< "no match" << endl;
98 if (regExp(NULL).match(me))
100 Info<< "matched: " << me << endl;
104 Info<< "no match" << endl;
113 // ************************************************************************* //