You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In PostCode we can provide any custom format. For example: AT-\d{4}
If we are not providing delimiters (/) with the regular expression it will be added inside: /^AT-\d[4}$/ so we match the full string provided.
The problem is that we can provide regular expression with any delimiter, for example: #^AT-\d{3}$# and it will be not detected correctly, so additional /^ and $/ will be added.
There might be a case also when adding /^ and $/ (with / delimiter) breaks the provided regular expression and other delimiter should be used.
Current behavior
We are attaching:
(prefix) /^ when first character of provided format is different than /
(suffix) $/ when the last character of provided format is different than /
Bug Report
Summary
In PostCode we can provide any custom format. For example:
AT-\d{4}
If we are not providing delimiters (
/
) with the regular expression it will be added inside:/^AT-\d[4}$/
so we match the full string provided.The problem is that we can provide regular expression with any delimiter, for example:
#^AT-\d{3}$#
and it will be not detected correctly, so additional/^
and$/
will be added.There might be a case also when adding
/^
and$/
(with/
delimiter) breaks the provided regular expression and other delimiter should be used.Current behavior
We are attaching:
/^
when first character of provided format is different than/
$/
when the last character of provided format is different than/
See:
laminas-i18n/src/Validator/PostCode.php
Lines 362 to 367 in 6aca912
How to reproduce
Expected behavior
We should detect any delimiter used or noted clearly in the documentation that only one supported delimiter is
/
.The text was updated successfully, but these errors were encountered: