about summary refs log tree commit diff

emoji regex generator

this is a small program i wrote to generate a size-optimized regular expression for matching emoji. i use this on a discord server (sorry) that has a channel for emoji-based polls. we set up the YAGPDB bot with some custom commands (which are limited to roughly ten thousand characters) to do so. since it's built roughly as a one-off tool for this, it outputs the language of the scripting system the bot uses, but this is mostly irrelevant.

usage

requires fennel (tested on version 1.0) running on lua 5.4.

$ fennel make-regex.fnl > regex.txt

it reads a list of emoji from emoji-test.txt, which can be obtained from the unicode consortium. the code for generating the output is near the end of the file, and the configuration for how the regex is optimized (which is particular to the data set) is placed at the top.