diff --git a/src/_utils.js b/src/_utils.js index 59c5a01..73da457 100644 --- a/src/_utils.js +++ b/src/_utils.js @@ -1,12 +1,15 @@ +/** + * @param {string} str + */ export function _partsSpecial(str) { - const cleaned = str.replace( - /^[\s]*([CMEDGPNATFSHMORW]{1,5})[^A-Z0-9]*([0-9]{4})[\s]*$/i, - "$1,$2" - ); + const cleaned = str.replace(/^[\s]*([CMEDGPNATFSHMORW]{1,5})[\W]*([0-9]{4})[\s]*$/i, "$1,$2"); return cleaned.split(","); } +/** + * @param {string} str + */ export function _partsOld(str) { const cleaned = str.replace( /^[\s]*([A-Z]{1,3})[^A-Z0-9]*([0-9]{4})[^A-Z0-9]*([A-Z]{2})[\s]*$/i, @@ -16,6 +19,9 @@ export function _partsOld(str) { return cleaned.split(","); } +/** + * @param {string} str + */ export function _partsNew(str) { const cleaned = str.replace( /^[\s]*([0-9]{4})[^A-Z0-9]*([BCDFGHJKLMNPRSTVWXYZ]{3})[\s]*$/i,