I am trying to filter some content from a file whose content is accessible to me as String
as :
block "block1"
{
ADDSFDJF
SDFSDFSDF
SDFSDFSDF
// subblock: subblock1 [master]
include "/path/tofile/subblock1.conf";
+/- subblock subblock1
// subblock: subblock1
subblock "subblock1"
{
type TYPE;
file "name.file";
details blah blah.
other {sdhsdf};
};
};
file "dddd.file";
details blah blah.
// subblock: subblock2
include "/path/tofile/subblock2.conf";
+/- subblock subblock2
// subblock: subblock2
subblock "subblock2"
{
type TYPE;
file "name.file";
details blah blah.
other {sdhsdf};
more fields
};
};
Here i want to delete some lines of each sub-block, i.e.: i want to remove these lines:
+/- subblock subblock1
// subblock: subblock1
subblock "subblock1"
{
type TYPE;
file "name.file";
details blah blah.
other {sdhsdf};
};
};
I was trying content.replaceALL();
but i am not able to create proper regex
which matches '+/-'
for start and proper closing '}' parenthesis for it.
Please help me through this.
[EDIT] : regex as a Java string