Regular expressions (regexes) are an amazingly powerful way to perform operations on collections of e.g. text. Regexss can also be considered to be a programming language, even a Turing complete one. Ergo it’s perfectly acceptable to thus design a way to use regexes to run and play a game of DOOM, as [Artem Lytkin] recently did.
The GitHub project page can be found here, containing the Python-based code that allows the demonstration to run, as well as the other components, including the C runtime and the 96.6 MB text string that defines a CPU’s registers, RAM, a framebuffer, the DOOM engine compiled to this custom CPU’s instruction set and the WAD file for the game itself.
The C-based driver applies the fixed, ordered list of find-and-replace rules to this string, which after more than ten-thousand of such substitutions later results in a single frame of the game. At about 80,000 substitutions per second on the given test system, that gets you to a sort-of playable framerate, even.
Naturally, the practical value of playing DOOM like this is pretty low, but as a demonstration of why regexes are awesome it’s hard to beat.

There’s nothing awesome about regex’s.
In years of software engineering our group always said there were 3 evils of computer science:
LDAP
Certificates
Regex’s
Why?
It is next to impossible to know what the coder intended scope of the regx to be.
The side effects and unintended security vulnerabilities are enormous. Let alone figuring how to change it without implementing weeks consuming unit tests.
My thoughts exactly
Namespaces in xml. But it’s more of a niche
I would really like an article that explores the most widely loathed technologies in software engineering. Perhaps a survey to collect a list then a poll for voting, then a deep dive on each of the top 10 into why they were so bad, along with a bit of devil’s advocate that attempts to provide some redemption.
What I learned from using regex a lot is that while I’m smart enough to create 1 large regex to solve problems it’s often easier to use 1 or more simple regex strings and basic string operations to get the result you want. If you want a regex string to do everything all at once they can get very complex, hard to test and hard to modify.
Ultimately a regex string is a finite state machine design.
You forgot MISRA. If what they intended was a dumbed down C, they should have created a new programming language.
i don’t understand… i mean, it really depends what you’re using it for… i mostly use regex with perl and grep in one-off hacks like to parse / compare test case outputs or to collate a dataset i just downloaded. i find it super handy because there’s so little effort to use it, and it doesn’t matter if it is too complicated to debug because it just has to work the one time. there’s usually no security implication because i just use it on the one dataset i already downloaded (and perhaps already sanitized).
i also sometimes use it for like cgi-bin or crontab that does download new stuff every day…in principle it could be a security risk, but it’s no different from any other programming…just don’t lose touch with where the string came from! in that case, i heavily prefer simple regex to complicated regex, because i might need to maintain it. ugh, i can’t imagine what hackaday will do to this string but like “if ($input =~ /^[a-z]+$/)” or “$input =~ s/[^a-z]/./g/” are pretty bulletproof. It’s easy to sanitize input with regex, you just shouldn’t forget to do it!
the biggest tension with regex imo is that there’s actually a pretty small range of situations where it makes sense to use something that complicated (as opposed to just like regular C “if (!strcmp(…))”) but that is also simple enough that regex is amenable to it. like, for parsing a language with nesting concepts, regex is almost completely unsuited. to parse XML or C/JSON-style expressions in perl, i usually use regex to write a lexer and then regular recursive descent to parse the lexed tokens.
so i guess i’m asking, what kind of twisted things are you using regex for where it becomes a problem? or maybe i’m admonishing, “if it hurts when you hit your head with a hammer, DON’T hit your head with a hammer!” :) but hammers are still very useful
Regex and Perl? Two write-only languages working together in perfect harmony.
As long as it’s only one thing.
The pedant in me can’t resist pointing out that regular expressions are very much NOT Turing complete. If what you’re using is Turing complete then it’s not a regular expression.
Yeah, we should all know that one cannot use regular expressions to parse html. Zalgo comes.
IMHO, good paen would be “Doom by regular expressions” : ]
So, in the game the character will be fighting RegEx’s? I mean, they are demonic, after all.
I’m glad I’m not the only one who could hear that buzzer while reading this.
They were so preoccupied with whether they could, they didn’t stop to think if they should