Reputation: 57
Patterns is working fine but i want them in one regex patter:
$reg_data['phone'] = preg_replace('/[\s\(\)]+/', '', $reg_data['phone']);
$reg_data['phone'] = preg_replace('/^\+998/', '', $reg_data['phone']);
Upvotes: 0
Views: 45
Reputation: 174696
Use an alternation operator |
.
$reg_data['phone'] = preg_replace('~[\s\(\)]+|^\+998~', '', $reg_data['phone']);
Upvotes: 2