fix matching html content as obsidian tags#537
fix matching html content as obsidian tags#537kai-kea wants to merge 1 commit intoObsidianToAnki:masterfrom
Conversation
addresses ObsidianToAnki#536 This regex matches obsidian tag style `#my-tag` only if it's not part of an HTML expression, e.g. from ObsidianToAnki#536, `&ObsidianToAnki#39;` will be matched and skipped over.
nicoberling
left a comment
There was a problem hiding this comment.
The RegExp you wrote adds an exceptions specifically for HTML special chars, instead it should simply match Obsidian tags, as described in the documentation:
/(?:^|[\t ])(#[a-zA-Z0-9\/_-]*[a-zA-Z\/_-][a-zA-Z0-9\/_-]*)+/g
This matches a tag preceded by the start of the line or whitespace, including at least one alphabetic letter, numbers, the hyphen, slash or underscore. Adapted slightly from here.
I agree, this solution is much cleaner. |
addresses #536
This regex matches obsidian tag style
#my-tagonly if it's not part of an HTML expression, e.g. from #536,'will be matched and skipped over.