-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Simplify some regular expressions #13961
Conversation
There's a fair number of regular expressions througout the code-base which are slightly more verbose than strictly necessary, in particular: - We have a lot of regular expressions that use `[0-9]` explicitly, and those can be simplified to use `\d` instead. - We have one instance of a regular expression containing a `A-Za-z0-9_` sequence, which can be simplified to use `\w` instead.
Would it be possible to have some linting on regexs ? |
That should certainly be possible, but so far I've not had time to investigate it fully yet (it's on my list of things to do). Thus far I've looked at:
I wanted to start small, with a simple PR containing mostly mechanical search-and-replace changes, to gauge the interest in this before spending a lot of time/effort to this :-) |
I'm the author of most of the regexs here and at least I can tell you why I did that: in some languages Anyway I'm fine with this change. |
/botio test |
From: Bot.io (Linux m4)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.241.84.105:8877/5a7d320ddf8a757/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @timvandermeij received. Current queue size: 0 Live output at: http://54.193.163.58:8877/1e1da1e33bf7582/output.txt |
From: Bot.io (Linux m4)FailedFull output at http://54.241.84.105:8877/5a7d320ddf8a757/output.txt Total script time: 21.60 mins
Image differences available at: http://54.241.84.105:8877/5a7d320ddf8a757/reftest-analyzer.html#web=eq.log |
From: Bot.io (Windows)FailedFull output at http://54.193.163.58:8877/1e1da1e33bf7582/output.txt Total script time: 39.79 mins
Image differences available at: http://54.193.163.58:8877/1e1da1e33bf7582/reftest-analyzer.html#web=eq.log |
Thanks! I'm also always a bit careful with |
There's a fair number of regular expressions througout the code-base which are slightly more verbose than strictly necessary, in particular:
[0-9]
explicitly, and those can be simplified to use\d
instead.A-Za-z0-9_
sequence, which can be simplified to use\w
instead.