diff --git a/omniNotes/src/main/java/it/feio/android/omninotes/utils/TagsHelper.java b/omniNotes/src/main/java/it/feio/android/omninotes/utils/TagsHelper.java index ac68bb50f2..f53dcab1ff 100644 --- a/omniNotes/src/main/java/it/feio/android/omninotes/utils/TagsHelper.java +++ b/omniNotes/src/main/java/it/feio/android/omninotes/utils/TagsHelper.java @@ -87,8 +87,9 @@ private static boolean mapContainsTag(HashMap tagsMap, Tag tag) public static Pair removeTag(String noteTitle, String noteContent, List 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); }