OP-TED / eForms-SDK

eForms is the notification standard for public procurement procedures in the EU. The eForms SDK is a collection of resources providing the foundation for building eForms applications.
Creative Commons Attribution 4.0 International
58 stars 30 forks source link

Question regarding ElectronicMail regex #1019

Open mdewinne opened 6 days ago

mdewinne commented 6 days ago

We noticed that the current regular expression for validating e-mail addresses (as used for example in fields.json) contains the html character code & in the character group right before the @.

Is there a particular reason why the regex is formulated this way and not by using the character & as such?

We try to align our platform as much as possible with the eForms standard, but noticed that said regex would - in its unaltered form - allow incorrect e-mail addresses containing a semicolon, as can be observed here: https://regex101.com/r/5qh1ZO/1

But even within the SDK framework, we think that there might be an inconsistency between fields.json and schematron validation. Our front-end notice editor (which shows inline validation based on fields.json) accepts the addresses with a semicolon, only to see them refused afterwards by the schematron, when saving and validating the notice.

bertrand-lorentz commented 2 days ago

The regex is used in the schematron files, where the character "&" must be escaped as "&". But it is indeed incorrect to have it escaped in fields.json.

We'll look into resolving this issue, so that the regex is fully correct in fields.json.

bertrand-lorentz commented 1 day ago

This will be corrected in SDK 1.13.0 (see linked commit above). Please note that the pattern to validate URL is also affected: it contained &, but also ", which will be replaced by \" (the correct escaping for JSON).