This is another lightweight tip—two in a row—that’s definitely just so that I have someplace to look it up, when I need to do it next.

For those of you—at least a few, based on the blog’s analytics—who came here looking for a “gone” emoji, you might be looking for dashing away 💨. Feel free to read around here, though.

Hundreds of randomly selected OpenMoji images

Anyway, in last week’s developer journal post, I mentioned that I considered changing the blog’s emoji set from Google’s Noto Color Emoji to OpenMoji. It’s a nice enough set, but I wanted to see what it would look like “in the wild,” as in the actual emoji usage I have, in its proper context.

That, in turn, requires knowing which posts have emoji, meaning that I need an easy search, since I tend to use emoji—and most other embellishments—sparingly. Strangely, the Unicode Consortium has seen fit not to collect emoji in a common position in their maps of code-points.

I won’t bore anybody with the research, but once we assemble the emoji code-point ranges, we can search for all blog posts that include at least one emoji with the following command.

grep -lP "[\x{1f300}-\x{1f5ff}\x{1f900}-\x{1f9ff}\x{1f600}-\x{1f64f}\x{1f680}-\x{1f6ff}\x{2600}-\x{26ff}\x{2700}-\x{27bf}\x{1f1e6}-\x{1f1ff}\x{1f191}-\x{1f251}\x{1f004}\x{1f0cf}\x{1f170}-\x{1f171}\x{1f17e}-\x{1f17f}\x{1f18e}\x{3030}\x{2b50}\x{2b55}\x{2934}-\x{2935}\x{2b05}-\x{2b07}\x{2b1b}-\x{2b1c}\x{3297}\x{3299}\x{303d}\x{00a9}\x{00ae}\x{2122}\x{23f3}\x{24c2}\x{23e9}-\x{23ef}\x{25b6}\x{23f8}-\x{23fa}]" _posts/*.md

For those of you not on a POSIX-compliant operating system, grep allows users to search a set of files—the last argument—for a search string represented as a mess that could be a regular expression before the files.

The -l (or --files-with-matches) option says to just list the names of the files where matches are found, rather than trying to print the line. The -P (or --perl-regexp) says to search using Perl Compatible Regular Expressions, which have some niceties beyond the older syntax.

In this case, our target search string is any character—that’s what the brackets ([...]) mean—in the specified ranges of hexadecimal values.

The result is a list of files, which I could then use to look at through Jekyll’s web server, to learn that no, while OpenMoji looks appealing, its design doesn’t fit my blog.

Alternatively…

You know what probably would have been faster than looking this all up and assembling that nightmare command? I could have just pasted a group of random emoji into the developer journal post that I was already looking at, to see how they look in general. They could even be random. Here’s a quick example, produced by one of many indistinguishable generators.

👆 📎 🛁 👶 🔇 🎯 👴 ✒️ 🎏 😚 👑 ⏫ 😳 🕙 🎹 ⛹ ♋️ ♨️ 🚊 🔩 🚦 🔮 ⌛️ 🏞 🚪 🐅 😰 💇 🔎 💧 🐡 🎣 🐸 🗳 🚜 🚢 📀 🔜 ☠ 🗄 🚈 🚛 ⛔️ 🕰 🏌 🐒 🔝 👤 🔱 🐐 ✝ 😡 🖱 🔓 🐘 🍖 ♑️ 🗼 ⌨ ⏳ #️⃣ 🚁 🔶 🌓 🕌 📒 🏄 🚤 👜 😇 🔫 😏 ◽️ 📍 💄 📣 💔 ✨ 🛂 🎬 🈹 1️⃣ 🈯️ 🔗 🍪 🎡 🏚 🌾 🐖 📽 🐶 ⤵️ 🍠 🐷 🛰 👛 🗒 🤕 🚝 ⭕️

Granted, that’s not the same as seeing the specific emoji that I’ve used in their contexts, but it also wouldn’t have been a terrible test. For example, it’s easy to compare the style of these—probably displaying as Noto on your screen—with the OpenMoji image at the top.

Coming Attractions

If there wasn’t enough programming involved in this post, take a good look at the header image. I created that programmatically, and do I ever have a story about that nightmare.

That, however, is another post…

😮‍💨


Credits: The header image is a random assortment of OpenMoji images, generated by me from images made available under the terms of the Creative Commons Attribution Share-Alike 4.0 International license.