Y
Hacker News
new
|
ask
|
show
|
jobs
by
petercooper
4435 days ago
The extension of that can also be handy and is often overlooked. Contrived example:
"28 men are 32 years old"[/(\d+) (year|day|month)/, 1] # => "32"