I have a lot of files in the following format:
SIMPLE
{
residualControl
{
p 1e-4;
U 1e-4;
"(k|omega|epsilon)" 1e-4;
}
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
potentialFlow
{
nNonOrthogonalCorrectors 10;
}
relaxationFactors
{
fields
{
p 0.3;
}
equations
{
U 0.7;
"(k|omega|epsilon).*" 0.7;
}
}
I want to match the following block of text in all files located in the folder $FOAM_TUTORIALS/incompressible
:
residualControl
{
// line 1
// line 2
// ...etc
}
When I use pcregrep
as follow:
pcregrep --color -r -M "residualControl.*\n.*\{(.*\n)*" $FOAM_TUTORIALS/incompressible/
it matches the other lines too (see the comment below):
SIMPLE
{
residualControl
{
p 1e-4;
U 1e-4;
"(k|omega|epsilon)" 1e-4;
} // <<<<<<<<<<<<<<<<<<<<<<<<<<< I want it to stop match here. But it matches also the lines below
nNonOrthogonalCorrectors 0;
pRefCell 0;
pRefValue 0;
}
potentialFlow
{
nNonOrthogonalCorrectors 10;
}
relaxationFactors
{
fields
{
p 0.3;
}
equations
{
U 0.7;
"(k|omega|epsilon).*" 0.7;
}
}
Could you please tell me how to modify the regex to match only the first block?