Skip to content

Commit

Permalink
Fixed tags removal when sharing common prefix (fix #634)
Browse files Browse the repository at this point in the history
  • Loading branch information
federicoiosue committed Dec 19, 2018
1 parent b4cc271 commit 77942a9
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ private static boolean mapContainsTag(HashMap<String, Integer> tagsMap, Tag tag)
public static Pair<String, String> removeTag(String noteTitle, String noteContent, List<Tag> tagsToRemove) {
String title = noteTitle, content = noteContent;
for (Tag tagToRemove : tagsToRemove) {
title = title.replaceAll(tagToRemove.getText(), "");
content = content.replaceAll(tagToRemove.getText(), "");
String tagRegex = tagToRemove.getText() + "(\\s)|" + tagToRemove.getText() + "$";
title = title.replaceAll(tagRegex, "");
content = content.replaceAll(tagRegex, "");
}
return new Pair<>(title, content);
}
Expand Down

0 comments on commit 77942a9

Please sign in to comment.