diff --git a/applications/test/fileName/Test-fileName.C b/applications/test/fileName/Test-fileName.C index 18f89b6db0..5de8912bd8 100644 --- a/applications/test/fileName/Test-fileName.C +++ b/applications/test/fileName/Test-fileName.C @@ -180,9 +180,9 @@ int main(int argc, char *argv[]) // A regex with a zero length matcher doesn't work at all: // eg "(png|jpg|txt|)" regex matcher itself - wordRe matcher0("()", wordRe::REGEXP); - wordRe matcher1("(png|jpg|txt)", wordRe::REGEXP); - wordRe matcher2("(png|txt)", wordRe::REGEXP); + wordRe matcher0("()", wordRe::REGEX); + wordRe matcher1("(png|jpg|txt)", wordRe::REGEX); + wordRe matcher2("(png|txt)", wordRe::REGEX); Info<<"Has extension(s):" << nl << "input: " << endWithDot << nl; diff --git a/applications/test/wordRe/Test-wordRe.C b/applications/test/wordRe/Test-wordRe.C index f5dfcda831..f3ab4a3719 100644 --- a/applications/test/wordRe/Test-wordRe.C +++ b/applications/test/wordRe/Test-wordRe.C @@ -3,7 +3,7 @@ \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation - \\/ M anipulation | + \\/ M anipulation | Copyright (C) 2017 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -30,7 +30,9 @@ Description #include "IFstream.H" #include "List.H" #include "Tuple2.H" +#include "keyType.H" #include "wordRe.H" +#include "wordRes.H" using namespace Foam; @@ -44,12 +46,36 @@ int main(int argc, char *argv[]) Foam::string s2("this .* file"); const char * s3 = "this .* file"; + keyType keyre("x.*", true); + + wordReList wordrelist + { + {"this", wordRe::LITERAL}, + {"x.*", wordRe::REGEX}, + {"file[a-b]", wordRe::REGEX}, + }; + + wordRes wrelist(wordrelist); + + Info<< "re-list:" << wrelist() << endl; + Info<< "match this: " << wrelist("this") << endl; + Info<< "match xyz: " << wrelist("xyz") << endl; + Info<< "match zyx: " << wrelist("zyx") << endl; + Info<< "match xyz: " << wrelist.match("xyz") << endl; + Info<< "keyre match: " << keyre("xyz") << endl; + Info<< "string match: " << string("this").match("xyz") << endl; + Info<< "string match: " << string("x.*")("xyz") << endl; + Info<< "string match: " << string("x.*")(keyre) << endl; + wordRe(s1, wordRe::DETECT).info(Info) << endl; wordRe(s2).info(Info) << endl; wordRe(s2, wordRe::DETECT).info(Info) << endl; - wordRe(s3, wordRe::REGEXP).info(Info) << endl; + wordRe(s3, wordRe::REGEX).info(Info) << endl; wre = "this .* file"; + + Info<<"substring: " << wre(4) << endl; + wre.info(Info) << endl; wre = s1; wre.info(Info) << endl; diff --git a/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.C b/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.C index 0de175b4b7..bc67aabd7f 100644 --- a/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.C +++ b/applications/utilities/miscellaneous/foamHelp/helpTypes/doxygenXmlParser/doxygenXmlParser.C @@ -24,7 +24,7 @@ License \*---------------------------------------------------------------------------*/ #include "doxygenXmlParser.H" -#include "wordRe.H" +#include "regExp.H" // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // @@ -40,8 +40,8 @@ Foam::doxygenXmlParser::doxygenXmlParser dictionary(dictionary::null) { // Pre-construct and compile regular expressions - const wordRe nameRe(".*.H", wordRe::DETECT); - const wordRe searchStrRe(searchStr, wordRe::DETECT); + const regExp nameRe(".*.H"); + const regExp searchStrRe(searchStr); // Pre-construct constant strings and names to speed-up comparisons const string slashStartTag('/' + startTag); @@ -163,7 +163,7 @@ Foam::doxygenXmlParser::doxygenXmlParser ( !exactMatch && !found(tName) // not already added - && wordRe(".*" + tName + ".*", wordRe::DETECT).match(name) + && regExp(".*" + tName + ".*").match(name) ) { dictionary dict(dictionary::null); diff --git a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C index c2a6f3b298..602f68b2d0 100644 --- a/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C +++ b/applications/utilities/postProcessing/dataConversion/foamToVTK/foamToVTK.C @@ -199,7 +199,7 @@ void print(Ostream& os, const wordList& flds) labelList getSelectedPatches ( const polyBoundaryMesh& patches, - const List& excludePatches + const wordRes& excludePatches ) { DynamicList