087xxxxxxx
086xxxxxxx
085xxxxxxx
083xxxxxxx
(087) xxxxxxx
(087)xxxxxxx
( 087 )xxxxxxx
( 087 ) xxxxxxx
087 xxxxxxx
087-xxxxxxx
087 - xxxxxxx
Code: Select all
#([( ]{0,2}08[3567])[) -]{0,3}([0-9]{7})#0879811111
Thanks
Moderator: General Moderators
Code: Select all
#([( ]{0,2}08[3567])[) -]{0,3}([0-9]{7})#Code: Select all
// Long version with comments:
'%
(?= # start a positive assertion for "no five digits in a row" logic
^ # anchor to start of line/string
(?: # start non-capture group to walk the string one char at a time
(?!00000|11111|22222|33333|44444|55555|66666|77777|88888|99999) # no 5 in a row?
. # Ok. at this position there are not four digits in a row - match this char
)*$ # repeat, checking each and every char, one at a time up to end of line
) # success. this string does not have five digits in a row
([( ]{0,2}08[3567])[) -]{0,3}([0-9]{7}) # now match your regex
%mx'
// short version
'/(?=^(?:(?!00000|11111|22222|33333|44444|55555|66666|77777|88888|99999).)*$)([( ]{0,2}08[3567])[) -]{0,3}([0-9]{7})/m'