11 ms·
Search "[ -~]" (with or without quotes) to see how good Google's comment is.
by missing_cipher 14y ago
Search "[ -~]" (with or without quotes) to see how good Google's comment is.
- logn 14y agoThe only ambiguous thing about this regex is knowing what's between space and tilde. Otherwise this is a pretty ordinary regex.
- wpietri 14y agoThe only thing ambiguous about it is most of it?
- masterzora 14y agoNot that I agree with the "expect people reading your code to Google things" mindset, but to be fair the only ambiguous thing is the ASCII table which is Googleable.
- darklajid 14y agoHey, might just be me. I'm usually the 'Ben, can you help me with a regular expression' guy over here, but I stumbled, hard, and failed to connect the '-' with a range of characters (probably because I never thought of 'space to .. something'). So I read the snippet, thought 'Yeah, a character class of space, -, ~' and fell on my face in the next couple of lines. Yeah, I should've known better, I know how to read it. If .. I invest the time and don't glance over a construct and hope to just get it instantly. I wouldn't want to see this in a code base without proper documentation (be it a comment, a function name or whatever. Something).