/    Sign up×
Community /Pin to ProfileBookmark

regular expressions problem

Hi all,

I created a regex for matching mobile number ..

$search = preg_match_all(“~(d{1,}s?|d?s?(d{1,})|d{1,}-)?s{0,}d{1,}[.s]?/?[.]?[.ss]?d{1,}[.s]?d{1,}[.s]?[.]?[.ss]?d{1,}~”,$text,$matches);

It works fine with most phone numbers, but sometimes it doesn’t work ..
This is a sample of a working number : + 2 010 5646024
and this is a sample of a not working number : + 2 385 230 61
I don’t understand why the second number + 2 385 230 61 is not matched …
N.B When I add any integer to the second number , it works , eg + 2 385 230 611

So how can I edit my regex to match the second number?

Regards,

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@darroosh2authorApr 01.2013 — no help ?

I only want to edit the code to match also + 2 385 230 611
×

Success!

Help @darroosh2 spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...