Skip to content

Commit

Permalink
Remove redundant RegExp character replace
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Mar 29, 2020
1 parent 7541acd commit 667db77
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ public String getExampleInput() {
@Override
public String format(String fieldText) {
// StringEscapeUtils converts characters and regex kills tags
return StringEscapeUtils.unescapeHtml4(fieldText).replaceAll("\\<[^>]*>","");
return StringEscapeUtils.unescapeHtml4(fieldText).replaceAll("<[^>]*>","");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public String format(String inField) {
.replaceAll("[\\n]{2,}", "<p>") // Replace double line breaks with <p>
.replace("\n", "<br>") // Replace single line breaks with <br>
.replace("\\$", "&dollar;") // Replace \$ with &dollar;
.replaceAll("\\$([^\\$]*)\\$", "\\{$1\\}"); // Replace $...$ with {...} to simplify conversion
.replaceAll("\\$([^$]*)\\$", "\\{$1\\}"); // Replace $...$ with {...} to simplify conversion

StringBuilder sb = new StringBuilder();
StringBuilder currentCommand = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public String format(String field) {
int i;
String finalResult = field.replaceAll("&|\\\\&", "&") // Replace & and \& with &
.replace("\\$", "&dollar;") // Replace \$ with &dollar;
.replaceAll("\\$([^\\$]*)\\$", "\\{$1\\}"); // Replace $...$ with {...} to simplify conversion
.replaceAll("\\$([^$]*)\\$", "\\{$1\\}"); // Replace $...$ with {...} to simplify conversion

StringBuilder sb = new StringBuilder();
StringBuilder currentCommand = null;
Expand Down

0 comments on commit 667db77

Please sign in to comment.