Just starting with js, decided to convert Friendfeed to a fluid app, and as part of that I need to be able to parse some numbers out of a string.
How do I complete this function?
function numMessages(text) {
MAGIC HAPPENS (POSSIBLY THE DARK ART OF THE REGEX)
return number;
}
input would be "Direct Messages (15)"
output would be 15.
Instincts tell me to find the first bracket then find the last bracket, and get the text in between but I don't know how to do that. Second instinct tells me to regex for [0-9], but I don't know how to run regexes in js. Jquery is avaliable already if needed.
Thanks!