Quick Hit: Regular Expression Visualizer

Steven NgCoding, Daily Debug Blog, LearningLeave a Comment

Regular expressions can be pretty intimidating when you are introduced to them. If you’re not familiar with regular expressions, think of them as a wildcard string for finding patterns in text. They’re incredibly useful for finding needles in haystacks of text and for super advanced search and replace. Most coding text editors support them, and many relational databases support them within their SQL statements.

Regexpr¬†lets you visualize a Javascript-style regular expression and see the logic behind it. Unfortunately, the site doesn’t provide any example regular expressions for you to use, which isn’t very helpful if you’ve never used them. I’ve included a few samples below to get you started.

Find snake_cased attributes:

\.(.[a-zA-Z0-9_]*?)

Find haml attributes:

:([A-z]+?) =>

Validate a YYYY-MM-DD date:

^(19|20)\d\d[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])$

 

Other articles by this author:

Please follow and like us:
error

Leave a Reply

Your email address will not be published. Required fields are marked *