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'm a professional PHP, Python and Javascript developer from the UK. I've worked with Django, Laravel, and React, among others. I also maintain a legacy Zend 1 application.
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.
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.
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 😆.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
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.
I'm going to guess that you have rubular.com bookmarked.
regexr.com is better, IMO. And it's open source! github.com/gskinner/regexr/
I just wrote a node-based regex editor:
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.
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: regex101.com/
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.
Agreed, especially since very few examples break them up into manageable bites and instead present you with strings for Cthulhu
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 😆.