Heads up! This blog post hasn't been updated in over 2 years. CodePen is an ever changing place, so if this post references features, you're probably better off checking the docs. Get in touch with support if you have further questions.

This has been possible ever since we integrated the CodeMirror Find & Replace functionality into CodePen, but it’s a bit hidden, so it’s worth explaining specifically. If you start any “Find” with a “/”, that will be a RegEx. So for example, Command/Control + F brings up “Find”:

A search for “/apples/” is basically the same as “apples”, but “/apples/iw” finds the one that begins with an uppercase “A” as well.

There is also Find and Replace functionality built in, which also takes the RegEx format. Here’s a very slightly more complex example where we’re matching strings that are a bit template-like.

There are loads of online RegEx testing tools to practice your RegEx’s, if that’s easier than trying on your real code. Like RegExr.