-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Conversation
The current pattern allows to much long mobile phone numbers, the new one fixes it.
Can you explain what you are trying to fix? The alteration you made only adds a matching group and thus uses more memory. It does not however change anything about the length issue you are talking about, because the regex itself is still the same as before. Edit: sorry, it seems it does fix the length issue |
@@ -13,7 +13,7 @@ | |||
'national' => array( | |||
'general' => '/^[124-9]\\d{8}|3\\d{3}(?:\\d{5})?$/', | |||
'fixed' => '/^[1-5]\\d{8}$/', | |||
'mobile' => '/^[6-7]\\d{8}|7[5-9]\\d{7}$/', | |||
'mobile' => '/^([6-7]\\d{8}|7[5-9]\\d{7})$/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can make it a non-matching group and save memory:
'/^(?:[6-7]\\d{8}|7[5-9]\\d{7})$/'
This needs an additional test case. |
Done. |
@@ -13,7 +13,7 @@ | |||
'national' => array( | |||
'general' => '/^[124-9]\\d{8}|3\\d{3}(?:\\d{5})?$/', | |||
'fixed' => '/^[1-5]\\d{8}$/', | |||
'mobile' => '/^[6-7]\\d{8}|7[5-9]\\d{7}$/', | |||
'mobile' => '/^(?:[6-7]\\d{8}|7[5-9]\\d{7})$/', | |||
'tollfree' => '/^80\\d{7}$/', | |||
'premium' => '/^3\\d{3}|89[1-37-9]\\d{6}$/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know what is a premium number, but the regex may have the same issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some failing cases in tests would have detected the problem.
@neilime manually merged @db18d96964440840b20e6f9510e52c370092b4ce, thanks! |
…-phone-numbers-fix' into develop Close zendframework/zendframework#6161
The current pattern allows to much long mobile phone numbers, the new one fixes it.