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

[FIX] find will return the pattern #167

Merged
merged 15 commits into from
Dec 31, 2021
Merged

[FIX] find will return the pattern #167

merged 15 commits into from
Dec 31, 2021

Conversation

omrilotan
Copy link
Owner

@omrilotan omrilotan commented Oct 9, 2021

Add "matches" and "clear" methods used to clear patterns matching a user agent string.

This will be a suitable solution for such cases. The example below includes extra steps to display the journey.

For example:

const ua = 'Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Firefox/52.0 SearchRobot/1.0'

sbot(ua) // true
isbot.find(ua) // 'Search'
isbot.matches(ua) // [ '(?<! cu)bot', '(?<! (ya|yandex))search' ]
isbot.clear(ua)
isbot(ua) // false
isbot.find(ua) // null

Resolve issue #166

@omrilotan omrilotan changed the title [FIX] find will return the pattern instead of the substring matced [FIX] find will return the pattern Dec 31, 2021
@omrilotan omrilotan merged commit d1628a9 into main Dec 31, 2021
@omrilotan omrilotan deleted the fix-find branch December 31, 2021 15:06
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.

1 participant