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

COUNTER_Robots_list.json: Remove unnecessary escaping of dashes #28

Merged
merged 1 commit into from
Nov 19, 2019

Conversation

alanorth
Copy link
Contributor

@alanorth alanorth commented Nov 9, 2019

It is not necessary to escape dashes (-) unless they are used in a character class where they could otherwise be used to note a range.

For example, in the expression "[a-z]" the dash indicates a range of characters from a to z. If you wanted to match a literal dash in a character class you would have to use "[a-z-]", meaning "a to z or a dash". As none of our uses are inside character classes, we do not need to escape them as literals.

I verified this by testing Java's java.util.regex.Pattern as well as several PCRE implementations.

It is not necessary to escape dashes (-) unless they are used in a
character class where they could otherwise be used to note a range.

For example, in the expression "[a-z]" the dash indicates a range
of characters from a to z. If you wanted to match a literal dash in
a character class you would have to use "[a-z\-]", meaning a to z
or a dash. As none of our uses are inside character classes, we do
not need to escape them as literals.

I verified this by testing Java's java.util.regex.Pattern as well
as several PCRE implementations.

See: https://www.freeformatter.com/java-regex-tester.html
See: https://regex101.com/
@davidatmire davidatmire merged commit 7319f71 into atmire:master Nov 19, 2019
davidatmire added a commit that referenced this pull request Nov 19, 2019
Updating last_changed for bots updated by #28
Adding the 3 following bots : 
^Buck\/\d
^LinkAnalyser
^User-Agent
@alanorth alanorth deleted the fix-regexes branch November 19, 2019 13:34
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