I have a function that finds the class name fc-id## which could be ex: fc-id3 or fc-id14
I turn this into fc-day##. The problem is it something like fc-id14 becomes fc-day1 ... It seems only the first digit is parsed...
$(mondays).each(function () {
var num = this.className.split(' ')[0].match(/fc-id(\d)/)[1];
var clsnme = '.fc-day' + num;
$(this).addClass('monday');
$(clsnme).addClass('monday');
});
How can I get it to parse the entire number?
/fc-id(\d+)/or/fc-id(\d*)/, first checks one or more digit while second checks 0 or more. Decide which one to usevar num = this.className.split(' ')[0].replace('fc-id','');do you really need a regular expression for this ?