[PHP] Re: Ereg/replace/i/ or something ??

2002-01-30 Thread J Smith
Try ereg(^[0-9]{10}$, $cust_tel); Quick explanation (I get the feeling you're new at regexes): ^ - beginning of string [0-9] - any number between 0 and 9 inclusive {10} - exactly ten times $ - end of string There ya go. J B. Verbeek wrote: Hello, I want to check the data from a

[PHP] Re: Ereg/replace/i/ or something ??

2002-01-30 Thread liljim
Hi Bart, I want to check the data from a form-field if it excists only of digits (0-9) and nothing else. How do I use the ereg()-function for this? Well, I prefer the preg_functions if (!preg_match(/^[0-9]{10}$/, $string)) { // contains stuff other than numbers, or is less than 10 digits

Re: [PHP] Re: Ereg/replace/i/ or something ??

2002-01-30 Thread Lars Torben Wilson
On Wed, 2002-01-30 at 08:16, liljim wrote: Hi Bart, I want to check the data from a form-field if it excists only of digits (0-9) and nothing else. How do I use the ereg()-function for this? Well, I prefer the preg_functions if (!preg_match(/^[0-9]{10}$/, $string)) { // contains