|
||||||
| PHP Forum Use this forum to discuss all aspects of PHP Development. PHP is a server-side, cross-platform, HTML embedded scripting language that lets you create dynamic web pages. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
| Sponsored Links |
|
|
|
|||||
|
I could do that, but I didn't think of this before, just check the phone number against two regular expressions (one with the area code, and one without it) like so:
PHP Code:
![]()
__________________
Emo Philips - "My computer beat me at checkers, but I sure beat it at kickboxing." |
|
|||||
|
How about this?
Code:
"/([0-9]{3}-?){1,2}[0-9]{4}/"
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
| Sponsored Links |
|
|
|
|||||
|
This:
Code:
([0-9]{3}-?)
Using your regular expression this may work Code:
/[0-9]{3}-[0-9]{3}?-[0-9]{4}/
![]()
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
|
|||||
|
I'll go with yours, because I think it works really well, with a lot of different formats.
You know any good sites to learn how to use these better? I think they are really hard to learn and a reference of all the characters used would be great.
__________________
Emo Philips - "My computer beat me at checkers, but I sure beat it at kickboxing." |
|
|||||
|
I'm in the process of writing a tutorial. You can expect it in a few days.
__________________
CodeCall Blog | CodeCall Wiki | Shareware | Linux Forum | My Blog Chat with other CodeCall members on IRC; connect to irc.codecall.net and join #codecall |
| Sponsored Links |
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| A small problem in my calc program | nolls | Pascal/Delphi | 18 | 02-28-2008 12:58 AM |
| Guess a Number | 3n! | C and C++ | 2 | 12-02-2007 04:44 PM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |
Goal: 100,000 Posts
Complete: 97%