codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
375 stars 70 forks source link

Escape hyphen in already correctly working regex to fix warning #1343

Closed trichoplax closed 4 hours ago

trichoplax commented 1 month ago

When running rails s to serve a local development instance, a warning is given:

warning: character class has '-' without escape: /[a-z0-9-.]+\.ngrok\-free\.app/

Nothing is broken. Ruby understands that the third hyphen inside the square brackets is a literal hyphen, not a range indicator. The regex already matches exactly what it should. The only problem is the warning, causing clutter in the terminal.

This pull request escapes the hyphen in order to fix the warning. There is no change to functionality.