var barcodes = [];
angular.forEach(newVal.split(/\r?\n/), function(line) {
- //remove all whitespace and commas
- line = line.replace(/[\s,]+/g,'');
-
//Or remove leading/trailing whitespace
- //line = line.replace(/(^[\s,]+|[\s,]+$/g,'');
+ line = line.replace(/^[\s,]+/g,'')
+ line = line.replace(/[\s,]+$/g,'');
if (!line) return;
barcodes.push(line);
var barcodes = [];
//split on commas and clean up barcodes
angular.forEach(args.barcode.split(/,/), function(line) {
- //remove all whitespace and commas
- line = line.replace(/[\s,]+/g,'');
-
//Or remove leading/trailing whitespace
- //line = line.replace(/(^[\s,]+|[\s,]+$/g,'');
+ line = line.replace(/^[\s,]+/g,'')
+ line = line.replace(/[\s,]+$/g,'');
if (!line) return;
barcodes.push(line);