RegEx Format Assistance

The thing is that those regex you put up there, both /\: (\d+)/ and /Job Id: (\d+)/ do work fine with a string like "Hidden out of Warranty | 00/00/0000 | Job Id: 4147271617".

That is:

let s = "Hidden out of Warranty | 00/00/0000 | Job Id: 4147271617";
let r1 = /\: (\d+)/;
let r2 = /Job Id: (\d+)/;

r1.exec(s); // -> [ ": 4147271617", "4147271617" ]
r2.exec(s); // -> [ "Job Id: 4147271617", "4147271617" ]

So, if it is not working for you, there's only two options: either there's something else in your code that is causing some problem or the string you are getting doesn't conform to that format or has some weird characters in it.

(Notice that case matters. Job is not the same as JOB. Just in case.)

/r/javascript Thread Parent