Reputation: 12512
I need to take a string of text
var myText = $(this).text();
which looks something like this
<my text (10)>
and strip down all but numeric value. I tried this but failed:
var myNum = myText.match(/<.*\(|\)>/);
Help...
Upvotes: 0
Views: 65
Reputation: 31250
var myNum = myText.replace(/[^0-9]/g, "");
EDIT:
var myNum = myText.match(/\(([0-9]+)\)/)[1];
Upvotes: 1