Hacker News new | past | comments | ask | show | jobs | submit login

Search "[ -~]" (with or without quotes) to see how good Google's comment is.



The only ambiguous thing about this regex is knowing what's between space and tilde. Otherwise this is a pretty ordinary regex.


Hey, 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).


The only thing ambiguous about it is most of it?


Not 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: