Skip to content

Commit

Permalink
debug default regex search. Remove bold tag for now as it wasn't work…
Browse files Browse the repository at this point in the history
…ing (unlike underline elsewhere).
  • Loading branch information
riverwanderer committed Oct 4, 2023
1 parent d9638b1 commit 3462a7a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions vassal-app/src/main/java/VASSAL/configure/ConfigureTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -2193,7 +2193,7 @@ public void actionPerformed(ActionEvent e) {
// Compute & display hit count as heading, no indent
final int matches = getNumMatches(searchParameters.getSearchString());
// FIXME: For some reason leading spaces now being stripped from Resource strings, hence added here
chatter.show("<b>" + matches + " " + (regexPattern == null ? Resources.getString("Editor.search_count") : Resources.getString("Editor.search_countRegex")) + ":</b> " + noHTML(regexPattern == null ? searchParameters.getSearchString() : regexPattern.toString()));
chatter.show(matches + " " + (regexPattern == null ? Resources.getString("Editor.search_count") : Resources.getString("Editor.search_countRegex")) + ": " + noHTML(regexPattern == null ? searchParameters.getSearchString() : regexPattern.toString()));
}
}

Expand Down Expand Up @@ -2702,11 +2702,10 @@ private Pattern setupRegexSearch(String searchString) {

// If the string contains no Regex operands, establish a useful default
// FIXME: escape characters will be interpreted as regex, bypassing the default. This may be ok anyway.

if (!searchString.matches("\\[a-zA-Z]|\\*|\\.|\\?|\\^|\\$|\\(.*?\\)|\\[.*?\\]|\\{.*?\\}|\\|")) {
try {
regexSearchString = ".*\\b" + searchString + "?";
Pattern.compile(regexSearchString); // test
Pattern.compile(".*\\b" + regexSearchString + ".*?"); // test default
regexSearchString = ".*\\b" + regexSearchString + ".*?"; // accept default
chat(Resources.getString("Editor.search_regexDefault") + noHTML(searchString)); // NON-NLS
}
catch (java.util.regex.PatternSyntaxException e) {
Expand Down

0 comments on commit 3462a7a

Please sign in to comment.