Live data from Hacker News

Show HN: RegEx for Regular Folk – A visual, example-based introduction

refrf.shreyasminocha.me

41–50 of 113 posts

Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction

#42
RegExr [0] does a great job of showing individual highlights even when they are in a sequential string. You can try to implement this if you want instead of showing a callout with a note to let the reader know that they highlights should be on individual characters.

[0] https://regexr.com/

Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction

#43
Hi, very nice RegEx educational site/book.

Feedback:

- In the chapter https://refrf.shreyasminocha.me/chapters/character-classes an example is given which uses:

  o ^ character outside brackets

  o $ end of line

  o +
But the explanation above does not introduce these yet, so a real beginner user (like me) is lost. The ambigious characters example is fine, since it uses all the concepts already explained.

Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction

#44
post #39

Just some 2cent feedback - don't assume anything is known. The BASIC lesson doesn't mention anything about /g. Having not touched regex in years I had no idea what that was and kept thinking 'why isn't he showing it matching a g if he has that in the example'.

Point. I've made the temporary omission of an explanation for /g explicit. I've also included a link to the relevant section of Flags in the note.

Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction

#45
This looks like a great resource! Like others, I vastly prefer an example-based style, and the examples are really well chosen and very illustrative. I generally think I know my regexes, but I've already learned a few tricks. (Backreferences to match different delimiter options but not mixed delimiters is very cool!)

Feedback:

The highlighting of matches is slightly shifted to the left for me in Firefox 75 but not in Chrome (both on Ubuntu 16.04). The shift is subtle but enough to make me have to look two or three times at most examples, as the highlight covers half of the character before the match and only half of the last character in the match. Can I suggest adding Firefox to your test regimen, if you haven't already? :)

Also, on the Anchors page, I believe "carat" should be spelled "caret."

Thanks for this once again! I will definitely be revisiting this site to brush up and learn new tricks. Especially lookaround, which I have never quite wrapped my head around!

Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction

#46

Hi, very nice RegEx educational site/book. Feedback: - In the chapter https://refrf.shreyasminocha.me/chapters/character-classes an example is given which uses: o ^ character outside brackets o $ end of line o + But the explanation above does not introduce these yet, so a real beginner user (like me) is lost. The ambigious characters example is fine, since it uses all the concepts already explained.

Thanks. Yeah, others pointed this out too. I'll get to it soon!

Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction

#47

This looks like a great resource! Like others, I vastly prefer an example-based style, and the examples are really well chosen and very illustrative. I generally think I know my regexes, but I've already learned a few tricks. (Backreferences to match different delimiter options but not mixed delimiters is very cool!) Feedback: The highlighting of matches is slightly shifted to the left for me in Firefox 75 but not in…

> The highlighting of matches is slightly shifted to the left … Can I suggest adding Firefox to your test regimen, if you haven't already? :)

Oh, I thought I had fixed that. I primarily test with Firefox, so this is a bit of a surprise. I'll check it out—I think it's something to do with CSS's `letter-spacing`.

I've fixed the typo, thanks for pointing it out.

Thanks for the comments!

Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction

#48
I personally had the most trouble with regexes because I didn't have a good mental model of how they worked. The hard part wasn't finding the correct symbol/character class I was trying to match, but coming to grips with repetition, greedy/nongreedy, etc.

I took a compilers class in college where one of the projects was to implement a simple regex matcher using NFAs. Bashing my head against this for a week really helped with being able to "read" a regex. Not sure if this was due to finally understanding the algorithm, or the fact that I was just constantly staring at broken regex matches all day.

IMO it was a fairly small time investment for something that is so widely used.

I'll recommend this post that's been on HN many times: https://swtch.com/~rsc/regexp/regexp1.html

Re: Show HN: RegEx for Regular Folk – A visual, example-based introduction

#49
In case it's useful for others, I found "Mastering Regular Expressions" by "Jeffrey E. F. Friedl" to be very effective for becoming proficient with Regex.

Also – reading it was just a useful look into systems mapping (which is what language is!) with insights that apply in many contexts.

Post reply on HN