Skip to content

Commit 667db77

Browse files
committed
Remove redundant RegExp character replace
Found by IntelliJ: https://www.jetbrains.com/help/phpstorm/regexp-redundant-character-escape.html
1 parent 7541acd commit 667db77

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/main/java/org/jabref/logic/formatter/bibtexfields/HtmlToUnicodeFormatter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,6 @@ public String getExampleInput() {
3333
@Override
3434
public String format(String fieldText) {
3535
// StringEscapeUtils converts characters and regex kills tags
36-
return StringEscapeUtils.unescapeHtml4(fieldText).replaceAll("\\<[^>]*>","");
36+
return StringEscapeUtils.unescapeHtml4(fieldText).replaceAll("<[^>]*>","");
3737
}
3838
}

src/main/java/org/jabref/logic/layout/format/HTMLChars.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public String format(String inField) {
2020
.replaceAll("[\\n]{2,}", "<p>") // Replace double line breaks with <p>
2121
.replace("\n", "<br>") // Replace single line breaks with <br>
2222
.replace("\\$", "&dollar;") // Replace \$ with &dollar;
23-
.replaceAll("\\$([^\\$]*)\\$", "\\{$1\\}"); // Replace $...$ with {...} to simplify conversion
23+
.replaceAll("\\$([^$]*)\\$", "\\{$1\\}"); // Replace $...$ with {...} to simplify conversion
2424

2525
StringBuilder sb = new StringBuilder();
2626
StringBuilder currentCommand = null;

src/main/java/org/jabref/logic/openoffice/OOPreFormatter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public String format(String field) {
1919
int i;
2020
String finalResult = field.replaceAll("&|\\\\&", "&") // Replace & and \& with &
2121
.replace("\\$", "&dollar;") // Replace \$ with &dollar;
22-
.replaceAll("\\$([^\\$]*)\\$", "\\{$1\\}"); // Replace $...$ with {...} to simplify conversion
22+
.replaceAll("\\$([^$]*)\\$", "\\{$1\\}"); // Replace $...$ with {...} to simplify conversion
2323

2424
StringBuilder sb = new StringBuilder();
2525
StringBuilder currentCommand = null;

0 commit comments

Comments
 (0)