You don’t need a regex for that

I once had a web site
on which one could search
for all sorts of things
(as long as they’re strings)

The items had titles
and content and more
so the search used a regex
to help you explore

We had an idea
we gave it a try
let’s help you find more
we’ll add synonyms galore

We tacked on those words
to the end of the regex
and straight to production
(we didn’t have stress tests)

And lo and behold
the site all but crashed
so many timeouts
we all were abashed

The change was reverted
and there we sat hurted
trying to think
what brought us to this brink

We researched those regexes
and guess what we found:
you should compile them first
if you want them around

So try that we did
and it didn’t work
the site was still slow
we hoped it’s a quirk

We tried many things
we were all stressing
until we decided
it’s time to start testing!

We drew up some schemes
for searching multiple words
and what a surprise
we saw with our eyes

String.Find()
was 1000 times faster
than all of those regexes
which caused the disaster

We learned our lesson
I hope you did too
regexes are evil
except for a few

If your regex is simple
just put it away
you’re probably wasting
your time anyway

All of us know
the truth’s where it’s at
in most of the cases
YOU DON’T NEED A REGEX FOR THAT

P.S.
Please excuse my bad rhymes and rhythm, I get paid to write software. Not poetry.