I’ve got a string like
foo (123) bar
I want to retrieve all numbers surrounded with the delimiters ( and ).
If I use varname.match(/\([0-9]+\)/), my delimiters are included in the response, and I get ‘(123)’ when what I really want is ‘123’.
How can I retrieve only a portion of the matched string without following it up with varname.replace()?
Yes, use capturing (non-escaped) parens: