regex2fat: Turn Your String Search Pattern Into a Labyrinth of Folders

Regular expressions (regexes) are among the more cryptic dialects of code, adding dense clusters of undifferentiated punctuation, even when written by programmers who otherwise go to great lengths to favor clarity. Continually confounding for beginning programmers, they are nearly unavoidable, appearing in nearly identical forms across many programming languages. Take, for instance, this quite common regex:

(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

As we can all see, it is how one determines whether an email address is valid.

8051Enthusiast has created a tool called regex2fat which translates regexes like the one above into disk images, creating a labyrinth of folders one can navigate through to find matches for their expression. Asked how he came up with the idea, he said:

I unfortunately can't really remember the moment it clicked, but I must have thought something like "Oh no that's terrible."

Read More


This entry originally appeared at esoteric.codes/blog/regex2fat, and may be a summary or abridged version.