Expand description
This library provides functionality to detect bot user agents using regular expressions.
It reads patterns from a JSON File, compiles them into a regex, and checks user agents against these patterns.
Modules§
Functions§
- create_
is_ bot - Creates a closure that checks if a user agent string matches a custom regex pattern
- create_
is_ bot_ from_ list - Creates a function to check if a user agent matches any bot pattern from a list.
- init_
pattern - Initialize the global regex pattern, only done once.
- is_bot
- Check if the given user agent includes a bot pattern.
- is_
bot_ match - Find the first non-empty capture group match of a bot pattern in the user agent string.
- is_
bot_ matches - Check if the given user agent matches any patterns in the provided JSON file.
- is_
bot_ pattern - Check if the given user agent matches any bot pattern and return the matching pattern.
- is_
bot_ patterns - Check which bot patterns from the given JSON file match the user agent.