DEV Community

Discussion on: Share a code snippet in any programming language and describe what's going on

Collapse
 
tracygjg profile image
Tracy Gilmore

If you throw the expression into something like Debuggex it can map out the routes through the expression, as follows.

RegExp diagram

However, whilst this shows what is happening it does not indicate why.

Collapse
 
auroratide profile image
Timothy Foster

Now that I'm staring at this chart, I'm recalling that at some point I was trying to parse markdown. Pretty sure this is looking for nested lists:

* Hello!
  1. A nested ordered list
Enter fullscreen mode Exit fullscreen mode

Though, it is interesting to me that the initial * or \d\. is not captured; one would think it'd be important to distinguish between an unordered and ordered list...

Thread Thread
 
tracygjg profile image
Tracy Gilmore

I studied the screenshot I attached to my comment and came to the same conclusion but it looks to me the expression might be more complicated than it needs to be - without fully understanding the context of course.