Live data from Hacker News

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

refrf.shreyasminocha.me

111–113 of 113 posts

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

#111
post #104

Earlier quoted context omitted.

Please do not forget the fact that after a couple of months, you want to make a small change, but you forgot the edge cases when you first created the regex :D

Unit tests will help with this.

I would have to unit-test my command line commands :)

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

#112
post #109

Earlier quoted context omitted.

>what is a literal character and what is a control character? I read a tip back in the Perl 5 book, that you can just escape any character if you don't remember if it has a special meaning. (You'll still get the literal character even if it didn't need escaping.) So I basically do that a lot. Never had any issue with control characters.

In my example, if you over-escape the first period or under-escape the second period the regex will undermatch or overmatch. for me it took a few tries to get filexc to not match and file.c to match in my example in the 3 languages.

My comment was just about what you call "under-escap[ing] the second period."

I mean if you don't know if a ,;:"%$$@!_€|~ or any other character means something you can just write \ before that character. In other words, without thinking of whether it means something in your regex language. I don't think = means anything, but I would write \= to match an equals sign, so I don't even have to think about it. So my comment was about matching literal characters of any kind. I would have used a \ for the literal period out of habit, just because it wasn't [A-Za-z]. So my version would have been right the first time.

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

#113
post #111
post #104

Earlier quoted context omitted.

Unit tests will help with this.

I would have to unit-test my command line commands :)

If they are critical: why not? If they aren't: you can live with missing a corner case or two. :-)
Post reply on HN