Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update default fallback regex to be less prone to overtriggering #40

Open
willdhorn opened this issue Feb 19, 2022 · 2 comments
Open

Update default fallback regex to be less prone to overtriggering #40

willdhorn opened this issue Feb 19, 2022 · 2 comments

Comments

@willdhorn
Copy link

I've noticed that the plugin overtriggers a lot when copy and pasting code, which has become more frustrating as I've started to use the Templater and Dataview plugins more.

After playing around with the regex tester on https://regexr.com, I found that the default fallback regex would match many function calls or object references. For example, the fairly straight forward templater expression <% tp.date.now(fmt_month, 0, tp.file.title, fmt_week) %> actually matches twice – once on tp.date.now(fmt_month and a second time on tp.file.title. While the second match is more understandable, as it could technically be a real URL with a weird TLD, I think that a fallback expression should not be prone to overtriggering.

As a less sensitive option, I'm suggesting that ((\w+:\/\/)[-a-zA-Z0-9:@;?&=\/%\+\.\*!'\(\),\$_\{\}\^~\[\]#|]+)` be used at the default fall back regex. In my (albeit brief) testing, I've found this to be much less prone to overtriggering and overall less frustrating to use copy and paste in my notes when working with templates and queries.

@GollyTicker
Copy link

Similar issue with different problem / solution suggestion: #39

@krlenell
Copy link

krlenell commented Jul 3, 2023

I was going to create an issue for this as I'm having trouble with Templater. Have you had good luck with the Regex suggested @willdhorn ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants