Replace bibtex or latex {\dg} string command in java -
i want write parser bibtex file. in bibtex-file there string booktitle = {wohnen - pflege - teilhabe {\dq}besser leben durch technik{\dq}}
. anyway, using junit-tests , method should detect , replace {\dg}
'
or "
. unfortunately not able write corresponding java code, example following code did not detect substring?
inproceedingscitation1 += " booktitle = {wohnen - pflege - teilhabe {\\dq}besser leben durch technik{\\dq}},\n";
corresponding part of replace-method:
string afterdg = ""; charsequence targetdg = "{\\dg}"; charsequence replacementdg = "\""; afterdg = afterae.replace(targetdg, replacementdg);
this regular expression should solve problem:
string afterdg = afterae.replaceall("\\{\\\\dq\\}", "\"");
for more details according regular expressions, have @ vogellas java regex tutorial.
Comments
Post a Comment