Closed sirlancelot closed 4 months ago
The RegExp is two largely identical character classes []
, with the first one also excluding numbers. The effect is that tags must start with a non-numerical character, followed by zero or more of any other character, including digits.
I wrote some tests here: https://regex101.com/r/6g27ZK/1
Cool, but I'm pretty sure there are multiple other places, for sure in some auto complete functions where similar regexes are used. Could you do a quick codebase search for the likes of hashtagRegex or tagRegex and similar as well? Browny points if you manage to centralize it all in one place.
I found one other file that uses it in web/
. I went ahead and consolidated the usage to common/
and imported it within web/
.
Hold up, it looks like the two RegExps are ever so slightly different. I can fix it in just a min.
Okay, it should be ready for you now! :)
This seems to work as advertised, thanks! Merging :)
Thank you!
Adjust the RegExp for matching tags in order to better support compatibility with other PKM systems. Though not the exact matcher used in Obsidian (since its source is closed), this matcher is modeled mostly after it and allows most non-whitespace characters, including Emoji.
I use a task line like
- [ ] Gift Idea #🎁 #Person-Name
to denote gift ideas for friends and family. This patch allows SilverBullet to recognize the emoji.