Tag Archives: regex

Online Regex Editor

I don’t know about you, but it isn’t the funnest part of my job when I have to pull out Regular Expressions and make a super long expression to match something… I especially dispise when I have to fix someone else’s Regex!

1
^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)$

You try figuring out what that does!

Well, it doesn’t have to be as painful with the online regex tool I recently found out about:

http://regexr.com/

On this site, you can write regex and sample text that needs to be matched and it will highlight whether it matches or not.

regexScreenshot

As well as get helpful hints to remember what the special characters mean:

regex3

Regex can definitely be confusing as many characters have special meaning based on the context – are we talking about a literal “:” or a ?: that means non-capturing group?

All in all, this tool makes Regular Expressions so easy! They also have a community feature so you can see if someone has uploaded a Regex pattern that you can build off of.

For my project today, I had to build a Regex that matches a semver version string. Here’s the Regex pattern I built with a little help from my coworker – thanks Daniel!

http://regexr.com/39s32