I wrote a TamperMonkey script to clean up LinkedIn results so jobs won't show if they don't meet certain criteria such as pay range. To do this I have the following:
var payYr = $(jobItem).text().toLowerCase().trim().match(/\$(.+?k?)\/yr/g);
console.log(payYr);
I've tested the regex repeatedly on live test sites which confirm that the resulting set should be an array of ONLY the numbers between the $ and the '/yr' values. That will usually be $##/yr or $###/yr values.
Input would be strings such as:
$115K/yr - $145K/yr · 6 benefits $180K/yr - $210K/yr
Expected output:
Array [ "115k", "145k" ];
Array [ "180k", "210k" ];
Instead, in Firefox, when I test it I'm getting arrays like so:
Array [ "$115k/yr", "$145k/yr" ];
Array [ "$180k/yr", "$210k/yr" ]
I can't figure out why the dollar sign and /yr values are being returned. By all accounts, that shouldn't happen and I don't know what's going on or how to fix it.