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

Clean up bot regexes #7549

Merged
merged 7 commits into from
Feb 12, 2024
Merged

Commits on Jan 5, 2024

  1. Configuration menu
    Copy the full SHA
    12704d3 View commit details
    Browse the repository at this point in the history
  2. Harmonize version parsing in bot regexes

    Bot version parsing in bot regexes is consistently done using `[\d.]+`.
    
    In particular, the following changes are made:
    
    - drop wrapper parentheses, where it is used, as the bot version is not
      exposed by the parser, and there is inconsistent use of grouping
      parentheses in the various regexes;
    - `[\d+.]` is assumed to be a typo picked up from the use of `\d+.`
      outside character classes;
    - `[\d+\.]` additionally uses a superfluous escape on the dot, which is
      not needed inside character classes;
    - plain `\d` or `[0-9]` are replaced with the common expression, as they
      will match the same agent strings, but include more of the version
      string in the match–mainly, this drives consistency;
    
    The main change that should arise here is that the plus character will
    no longer be recognised as part of the bot/version match. The tests
    don't suggest that this will be an issue. (If needed, the `+` can be
    brought back, while keeping consistency)
    biochimia committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    673ef8b View commit details
    Browse the repository at this point in the history
  3. Prefer non capturing parentheses in bot regexes

    Given that the groupings don't have a meaning, there's little point in
    keeping them as part of the regexes. In addition, superfluous
    parentheses are dropped.
    biochimia committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    bcbec7a View commit details
    Browse the repository at this point in the history
  4. Drop wildcard matches at end of input in bot regexes

    The wildcard matches extend the match, but don't add value as the match
    is already made at that point.
    biochimia committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    f6ad918 View commit details
    Browse the repository at this point in the history
  5. Put - at end of character class in regex

    This avoids the need to escape the dash in character classes.
    biochimia committed Jan 5, 2024
    Configuration menu
    Copy the full SHA
    9dc9bda View commit details
    Browse the repository at this point in the history

Commits on Feb 12, 2024

  1. Configuration menu
    Copy the full SHA
    8bb0102 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    d9199a3 View commit details
    Browse the repository at this point in the history