how toString() is used

sirou
Tera Contributor

hello everyone

 

I have a question about how toString() is used

 

var s = sys_email.sys_id;
var mm = s.subject.toString();
var reg = /\[[0-9]+\]/;
var result = (mm.match(reg) + "").match(/[0-9]+/)+ "";

 

Why can't this script extract the number from the email subject line?