Skip to content

Commit

Permalink
[BUGFIX] fix invalid phone regex
Browse files Browse the repository at this point in the history
The dash at the end of the regex is interpreted as regex group in chrome and firefox so we have to escape it
  • Loading branch information
revoltek-daniel authored and mschwemer committed Sep 18, 2024
1 parent 6fb59ce commit 93f43f7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ protected function addValidationAttributes(array $additionalAttributes, Field $f
*
* html5 example:
* <input type="text"
* pattern="/^(\+\d{1,4}|0+\d{1,5}|\(\d{1,5})[\d\s\/\(\)-]*\d+$/" />
* pattern="/^(\+\d{1,4}|0+\d{1,5}|\(\d{1,5})[\d\s\/\(\)\-]*\d+$/" />
* javascript example:
* <input ... data-powermail-pattern=
* "/^(\+\d{1,4}|0+\d{1,5}|\(\d{1,5})[\d\s\/\(\)-]*\d+$/" />
* "/^(\+\d{1,4}|0+\d{1,5}|\(\d{1,5})[\d\s\/\(\)\-]*\d+$/" />
*/
case 3:
$pattern = '^(\+\d{1,4}|0+\d{1,5}|\(\d{1,5})[\d\s\/\(\)-]*\d+$';
$pattern = '^(\+\d{1,4}|0+\d{1,5}|\(\d{1,5})[\d\s\/\(\)\-]*\d+$';
if ($this->isNativeValidationEnabled()) {
$additionalAttributes['pattern'] = $pattern;
} else {
Expand Down

0 comments on commit 93f43f7

Please sign in to comment.