Barcode Scanning: Special Characters to Carriage Return / line breaks

We scan the barcode by individually (1D barcode) with automatic carriage return. But when we scan pdf417 type barcodes which contain multiple serial numbers separated by space or | or “space”. Some vendor’s already encoded with carriage return.

Currently we are using notepad++ to collect all the serial numbers and convert the | to \n

Is there any way to generate a script which will find these special characters into line breaks?

You can use below code to replace whitespace and pipe with new line:
frappe.ui.form.on(“Delivery Note Item”, {
serial_no: function(frm, dt, dn) {
var d = locals[dt][dn];
d.serial_no = d.serial_no.replace(/[|\s]/g,“\r\n”);


thanks Mr. Sanjay works fine…