I need a javascript code to extract number from string like "pushedProductType0".
1 Answer
alert( "pushedProductType0".match(/\d/) )
3 Comments
gen_Eric
This will get the 1st number, and only single digits. You should do
.match(/\d+/g)Billy Moon
I agree with
/\d+/ but the global flag is not appropriate as it would return an array. This is just a starter for 10, the question is not specific enough to develop any furtherMr_Nizzle
Any hint on getting the
last one ? Here's my question: stackoverflow.com/questions/11059054/…