mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support negated regular expressions (#2283)
- extendes the prefix syntax to handle '!' values. For example, "(?!).*processor.*" or "(?!i)inlet.*"
This commit is contained in:
@ -252,12 +252,16 @@ void testExpressions(const UList<regexTest>& tests)
|
||||
}
|
||||
else if (re.search(str))
|
||||
{
|
||||
Info<< "partial match";
|
||||
Info<< "partial";
|
||||
}
|
||||
else
|
||||
{
|
||||
Info<< "false";
|
||||
}
|
||||
if (re.negated())
|
||||
{
|
||||
Info<< " (negated)";
|
||||
}
|
||||
Info<< endl;
|
||||
}
|
||||
catch (const Foam::error& err)
|
||||
@ -329,6 +333,15 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
Info<< "sizeof std::regex: " << sizeof(std::regex) << nl;
|
||||
Info<< "sizeof regex C++11: " << sizeof(regExpCxx) << nl;
|
||||
#ifndef _WIN32
|
||||
Info<< "sizeof regex POSIX: " << sizeof(regExpPosix) << nl;
|
||||
#endif
|
||||
Info<< "sizeof word: " << sizeof(Foam::word) << nl;
|
||||
Info<< "sizeof wordRe: " << sizeof(Foam::wordRe) << nl;
|
||||
Info<< "sizeof keyType: " << sizeof(Foam::keyType) << nl;
|
||||
|
||||
if (!args.count({"cxx", "posix"}))
|
||||
{
|
||||
args.setOption("cxx");
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/*--------------------------------*- C++ -*----------------------------------*\
|
||||
| ========= | |
|
||||
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
|
||||
| \\ / O peration | Version: v2106 |
|
||||
| \\ / O peration | Version: v2112 |
|
||||
| \\ / A nd | Website: www.openfoam.com |
|
||||
| \\/ M anipulation | |
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -12,6 +12,8 @@
|
||||
(
|
||||
( true "(U|k|epsilon)" "U" )
|
||||
( false "(U|k|epsilon)" "alpha" )
|
||||
( true "(?!)(U|k|epsilon)" "alpha" )
|
||||
( true "(?! *&)(U|k|epsilon)" "alpha" ) // Ignore unknown content
|
||||
( true "ab.*" "abc" )
|
||||
( true ".*" "abc" )
|
||||
|
||||
|
||||
Reference in New Issue
Block a user