about summary refs log tree commit diff
path: root/README.md
blob: 6614a85f196dcdb39cae59e5b2dde6f89f2692bb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# 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](https://yagpdb.xyz) 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](https://fennel-lang.org) (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.