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

Add a naive regex fallback #237

Merged
merged 8 commits into from
Jan 12, 2024
Merged

Add a naive regex fallback #237

merged 8 commits into from
Jan 12, 2024

Conversation

omrilotan
Copy link
Owner

This changeset adds a fallback for engines that do not support lookbehind in regular expressions. This fallback is less accurate but catches ~78% of bots with less than 1% false-positive.
It is also exposed as "isbotNaive" export.

Solves #236

@@ -11,7 +11,6 @@
"(?<![hg]m)score",
"@[a-z]",
"\\(at\\)[a-z]",
"\\(github\\.com/",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes seem out of scope for this fix?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, this is a side effect of my creating the naive pattern. I examined parts of the existing regular expression and replaced them with more efficient patterns that allow the same coverage.

@omrilotan omrilotan merged commit 3759392 into main Jan 12, 2024
8 checks passed
@omrilotan omrilotan deleted the isbot_naive branch January 12, 2024 09:40
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

Successfully merging this pull request may close these issues.

2 participants