Last active
February 2, 2025 04:49
-
-
Save Isaddo/e9185573cb3b2df9d0503abd65c2d7ee to your computer and use it in GitHub Desktop.
用 regular expression 驗證電子發票手機條碼格式 。E-invoice mobile barcode validator by regular expression.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* 第 1 碼為 / | |
* 其餘 7 碼為 0-9 A-Z . - + | |
*/ | |
module.exports = (value) => { | |
// - 需放最後,不然要會跟 0-9 的 - 混淆 | |
const patt = /^\/[0-9A-Z.+-]{7}$/ | |
if (patt.test(value)) return null | |
return '手機載具碼錯誤' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment