This is a discussion on "[SOLVED] using .match" within the JavaScript Forum section. This forum, and the thread "[SOLVED] using .match are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
[SOLVED] using .match
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
|||
|
[SOLVED] using .match
Hi,
Im using the .match command to check to see if the value of a form starts with "+44" and if so raise an alert. That bit is pretty easy but what I cant get it to do is check that the value starts with "+44" AND THEN check if there are any of the numbers "3, 4, 5, 6, 8, 9, 0". Here is the code. Any help would be greatly appreciatted.
|
|
|
|
||||
|
Re: using .match
You can try
if (temp.match(/^(\+44 )([3-6]|[8-9]|0|1){1}/))
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
Last edited by Rakuli; Oct 29th, 2007 at 12:03. Reason: Fixed typo |
|
|||
|
Re: using .match
for some reason that doesnt seem to work. It doesnt raise the alert if you put in a number such as +443392666666.
Any ideas??? Thanks as usual to Rakuli |
|
|||
|
Re: using .match
hang on... I dont think I explained the situation well enough in the first place.
It needs to check if the number begins with +44 if so, it checks to see if the 4th character is either 3,4,5,6,8,9 and if both are true raise the alert. Sorry about that rakuli. Thanks eon. |
|
||||
|
Re: using .match
Okay,
if (temp.match(/^(\+44 )([3-6]{1}|[8-9]{1}|0|1)/))
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
|
|||
|
Re: using .match
still not working... I cant see why??
Here is the full code just incase I have mucked another rule up somewhere....
|
|
|||
|
Re: using .match
Hey,
Ive fixed it now by using....
|
|
||||
|
Re: using .match
Hmm, usually pretty good with regex but haven't used in a while - not sure why it's not matching...
if (temp.match(/^(\+44[3-6]{1}|\+44[8-9]{1}|\+44[0-1]{1})/))
Last Blog Entry: The wannabe juggler's quest (Oct 27th, 2007)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need assistance verifying that two emails match in a form - please help! Thank you! | vanbot | JavaScript Forum | 1 | Jun 12th, 2008 21:55 |
| [SOLVED] 1 solved problem causes another | delusion | Web Page Design | 9 | Dec 21st, 2007 08:12 |
| Adding "Topic Solved" for solved topics | AdRock | Webforumz Suggestions and Feedback | 21 | Oct 4th, 2007 15:08 |
| innerHTML and innerHTML match | DregondRahl | JavaScript Forum | 2 | Jun 11th, 2007 13:24 |
| Photoshop Tennis Match 1 - Billydakid Vs Sirkent | Webforumz Staff | Graphics and 3D | 13 | Feb 10th, 2004 16:22 |