re: What are the least intuitive fundamentals and best practices in software development? VIEW POST


I’ve gotta go with regex. I didn’t ever really get “taught” regex, and Googling to find that the answer to my problem was a bunch of gobbledygook was a trip.


I learned regexes by learning Perl in 2010. Ever since then my once-fearsome regex skills have atrophied to the point that I now struggle to write one.


Agreed, especially since very few examples break them up into manageable bites and instead present you with strings for Cthulhu


I just wrote a node-based regex editor:

GitHub logo johannesvollmer / regex-nodes

Visualize and edit regular expressions for use in javascript

Regex Nodes

This node-based regular expression editor helps you understand and edit regular expressions for use in your Javascript code.

If your regular expressions are complex enough to give this editor relevance you probably should consider not using regular expressions, haha.

Why Nodes?

One of the problems with regular expressions is that they get quite messy very quickly. Operator precedence is not always obvious and can be misleading Nodes, on the other hand, are a visual hierarchy. A text-based regex cannot simply be broken into several lines or indented because that would alter the meaning of the expression.

The other major benefit of nodes is that the editor will prevent you from producing invalid expressions. Other regex editors analyze the possibly incorrect regular expression that the user has come up with. The node editor will allow you to enter your intention and generate a correct regular expression.

In addition, nodes…

If you have some spare time, let me know what you think of it!


I've been cheating for years using:

Best thing is it explains what each bit is doing so I can learn as I go along.


The funny thing is, I've found it's sometimes far easier and cleaner to just write a full parser than a really complicated regex. A pretty decent recursive descent parser only takes a few dozen lines of code, and you get full recursive structures and an AST, which are a whole lot easier to work with than complex capturing groups.

Regex is a very useful tool, but don't let that be the only tool in your arsenal for String processing.


I agree. I avoided RegEx's for a couple years. One morning I sat down with a cup of coffee and forced myself to thoroughly read through this chapter (great book in general). Now I'm using RegEx on a daily basis and loving it. I really liked the diagrams in the Eloquent chapter, helped me make sense of the gobbledygook.

I mostly write JavaScript, but that chapter also helped me a lot with writing Nginx/Apache proxies and rewrites. Now I'm not doing Google-guess-and-check when writing proxies in Nginx 😆.

code of conduct - report abuse