Now I have 2 problems…

Kevin Salter
Kevin Salter’s Blog
1 min readJun 6, 2016
https://regex101.com/r/hB1xO8/25

Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems. — Jamie Zawinski

While this well-known quote serves as fair warning, there are times when you will want or need to use regular expressions. When that day comes, there are some powerful tools out there that can help you nail down exactly the expression you need.

I recently used the site regex101.com during a code review to go back and forth with some colleagues, trying to find an appropriate regular expression for parsing @ mentions that conformed to our application’s requirements. Regex101.com is great because we can save our progress and post a new URL in the pull request discussion as we hash things out. Our final expression looked like this: https://regex101.com/r/hB1xO8/25

Another useful by-product of this process is that we can use all of the different examples in the “Test String” textarea to write the unit tests! 🚀

footnote: regexr.com is also really cool

--

--