Hacker News new | ask | show | jobs
by arp242 1044 days ago
> It actually increments each word it finds

Did you try it? Because that's not what it does. submatch(0) expands to the first submatch, which is the entire thing that's matched, and +1 adds 1 to this, which will a;ways result in "1" here since any string that doesn't start with a digit will be type-coerced to 0.

Anyway, /n being intended sounds likely; I forgot that would report the number of matches. Still very odd how that got morphed to what's in the article.

1 comments

> Did you try it?

Yes

> Because that's not what it does. [...]

I don't see how your description significantly differs from my description.