I thought I'd share my favorite regex of all time.

[ -~]

Any idea what this regexp matches? Scroll down for the answer.

.

.

.

.

.

.

.

.

.

It matches all ASCII characters from the space to tilde. What are these characters? These are all printable characters!

Take a look at this ASCII table. Printable characters start at the space and end at tilde (in light blue background). Non-printable characters are all remaining characters (in white background).

[ -~] matches all printable ASCII characters.

I love this so much!

ASCII Regex T-Shirt

Want to wear this regular expression? I just had an idea to put it on a t-shirt as this blog post was getting so popular. Check out this limited-edition t-shirt that I made.

Update: Sold out and no longer available.

See you next time!