marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
2.99k stars 790 forks source link

Issue with Regexp golf solution #555

Closed gpskalra closed 2 years ago

gpskalra commented 2 years ago

Regexp Golf is the first exercise of Chapter 9. The issue concerns matching "Any word ending in ious". The solution provided (\ious\b) will match strings like "$$ious" where non alphanumeric characters precede "ious". Should the right solution be /\b\w*ious\b/ ?

gpskalra commented 2 years ago

Similar issue with "word longer than 6 letters". Should it be /\b\w{7,}\b/ instead of /\w{7}/?

marijnh commented 2 years ago

I think it's okay to consider 'ious' is itself to be a word ending in 'ious', so I don't feel this is a problem with the solution.