From 4203c225a8e1341837ac53591a51862a3cc4a43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alja=C5=BE=20Starc?= Date: Thu, 8 Sep 2022 17:47:37 +0000 Subject: [PATCH] improved regex for issuer_name and issuer_address --- src/index.js | 4 ++-- src/views/index.ejs | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/index.js b/src/index.js index 2348916..34ec6a8 100644 --- a/src/index.js +++ b/src/index.js @@ -38,8 +38,8 @@ app.get('/api/qrcode', async (req, res) => { check('payment_purpose', /^.{1,42}$/i) check('iban', /^[A-Z]{2}\d{17}$/) check('reference', /^[A-Z]{2}[0-9\-]{1,24}$/) - check('issuer_name', /^[a-zA-Z0-9ČŠŽĐ.'](?:[A-Z0-9 ČŠŽĐ.']{0,31}[A-Z0-9ČŠŽĐ.'])?$/i) - check('issuer_address', /^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ]{0,31}[A-Z0-9ČŠŽĐ])?$/i) + check('issuer_name', /^[a-zA-Z0-9ČŠŽĐ.'](?:[A-Z0-9 ČŠŽĐ.'\-]{0,31}[A-Z0-9ČŠŽĐ.'])?$/i) + check('issuer_address', /^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ\-.]{0,31}[A-Z0-9ČŠŽĐ])?$/i) check('issuer_city', /^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ]{0,31}[A-Z0-9ČŠŽĐ])?$/i) // SET DEFAULT PURPOSE_CODE diff --git a/src/views/index.ejs b/src/views/index.ejs index 4907af2..a940c91 100644 --- a/src/views/index.ejs +++ b/src/views/index.ejs @@ -314,9 +314,9 @@ updateQR()
🔗 issuer_name
- Regex: ^[a-zA-Z0-9ČŠŽĐ.'](?:[A-Z0-9 ČŠŽĐ.']{0,31}[A-Z0-9ČŠŽĐ.'])?$/i + Regex: ^[a-zA-Z0-9ČŠŽĐ.'](?:[A-Z0-9 ČŠŽĐ.'\-]{0,31}[A-Z0-9ČŠŽĐ.'])?$/i
- Demo: regex101.com/r/ubDgZL/1 + Demo: regex101.com/r/ubDgZL/1
Description: Name and surname of the issuer or company name. Max length 33 characters including spaces and numbers.
@@ -325,13 +325,13 @@ updateQR()
🔗 issuer_address
- Regex: ^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ]{0,31}[A-Z0-9ČŠŽĐ])?$/i + Regex: ^[a-zA-Z0-9ČŠŽĐ](?:[A-Z0-9 ČŠŽĐ\-.]{0,31}[A-Z0-9ČŠŽĐ])?$/i
- Demo: regex101.com/r/5oKk0T/1 + Demo: regex101.com/r/5oKk0T/1
- Description: Full issuer address in long form. Max length 33 characters including spaces and numbers. + Description: Full issuer address in long form. Max length 33 characters including spaces, numbers, minus and dot.
- Example: Za deveto smreko 15 k + Example: Za deveto smreko 15-k p.p. 15
🔗 issuer_city