Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Dennis Brown
Dennis Brown
28,742 Points

Learning RegEx, preferably with JavaScript?

I have been fumbling through the RegEx courses on the site (Java/Python), mixed with RegEx101.com just to get some well needed coverage of RegEx. Java was easy to follow, and gave some basics, but the Python course seems to offer the most information. It is also the hardest to follow when your choice language is JavaScript.

Regardless, I need some resources to help teach the more complex portions of RegEx, and so far this is the closest thing. Does anyone have any suggested training anywhere else?

Hi Dennis,

not a training recommendation as such, but I've used https://regex101.com/ , which lets you input a test string to build your regex around, then when you are happy with it you can choose a language you prefer and it will produce code for you or you can use your own.

Personally, I found playing around with this tool helped me better understand regular expressions.

Hope this is useful to you.

Graeme

Dennis Brown
Dennis Brown
28,742 Points

I always appreciate the input Graemehunt!

Yes, as mentioned, RegEx101 is something I have been using paired with the limited instruction here, and it definitely came in handy at first. I also found http://regexr.com/ last night as well, which gives a bit more information compared to RegEx101 (definitely a must-have too).

These types of sites have helped me a great deal, but now I'm getting into some serious group magic with specific groups, non-capturing groups, tagging groups, iterating groups, and in need of something to help me move from the basics to the more advanced practices. I could fumble around on the regex emulators, but it wasn't until recently that I found that regex101 wasn't telling me when options were not available in JS (RegExr does this), and need to find a resource that covers the practices used as well as those specific to replacing the missing functionality.

It looks like I may need to go over to Amazon and O'reilly and look for a JS RegEx book.

Ah ok Dennis,

it looks like you're way way ahead of me on this!! I had a scout around for some training previously and in a hurry to get something together for a project - looks like I may have to look you up when I need an expert to reconfigure my poorly conceived regex!

Happy hunting for resources and keep me posted if you find anything interesting!

Graeme

Dennis Brown
Dennis Brown
28,742 Points

No problem, and thanks so much for the input!

I will definitely keep you up to date as to what I find, as it is definitely one of those subjects that must have a nice program somewhere. Glad to know I'm not alone on this. :)

1 Answer

Dennis Brown
Dennis Brown
28,742 Points

Ok, so I found some pretty awesome resources in the past 24 hours to learn RegEx in-depth.

First off is a web-app from the makers of try ruby, and try Haskell, called .... drumroll .... Try Regex! While it's not entirely in-depth (yet), it does show the basics of RegEx, while introducing the many ways to use them with JavaScript in an interactive environment.

Then there was RegExOne, which is another interactive RegEx tutorial site, which covers basic grouping.

Then I found this awesome O'reilly Video on YouTube, where Web-Dev Lea Verou covers RegEx, with a JavaScript Focus. To make things even better, you can use her own Regex App to follow along with the presentation.

Lastly I found three great resources for learning much more about RegEx. First is Regular-Expressions.info, which is an online document of sorts. Then there is Regex Pro (App Store, Play Store, and Amazon Underground), which is a great mobile reference to RegEx, and then the Regular Expressions Cookbook 2nd Edition, which is almost 600 pages of RegEx goodness and examples for all Languages. It also goes as far as to discuss the limitations with JavaScript, and showing how to capture various groups of matches in several different and advanced use-cases (It can be found on Safari Online as well). While I haven't been able to get through too much of it, I was very impressed skimming through it, and the Table of Contents certainly show quite a bit of juicy topics to be covered.

So lots of great resources, but unfortunately not a single one-stop-shop (yet?).