0

I am working with a set of blood pressure readings, for example

lines[50] = '(523,112)';

and I am using

readings[i] = lines[i].slice(5,8);

to extract the second 3 digit number. How can this be done with a regular expression?

2 Answers 2

2

This should give you the desired result. See here for more details

'(523,112)'.match(/,(\d+)/)[1]
Sign up to request clarification or add additional context in comments.

Comments

0

Try this:

readings[i] = lines[i].match(/\d+(?=\))/);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.