I want to check a string for only numbers and letters but am banging
my head with regex:
$good = joh_';
// Let's check the good e-mail
if (preg_match(/[a-z0-9]/, $good)) {
echo Good;
} else {
echo Bad;
}
This returns Good, why?
Thanks!
--
PHP General Mailing List
blackwater dev wrote:
I want to check a string for only numbers and letters but am banging
my head with regex:
ctype_alnum()
Chris
--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit:
On 12 Apr 2005 blackwater dev wrote:
$good = joh_';
// Let's check the good e-mail
if (preg_match(/[a-z0-9]/, $good)) {
echo Good;
} else {
echo Bad;
}
This returns Good, why?
That regex matches any string which contains at least one (lowercase)
letter or one number
I've been looking at the docs and found preg_match and preg_match_all but
these functions only seem to match 1 specific search item. I want to make
sure a variable (say $mlsnumber) contains only numbers and no spaces. What
would I use to accomplish this?
Thanks
Ed
--
PHP General Mailing List
Ed Curtis wrote / napsal (a):
I've been looking at the docs and found preg_match and preg_match_all but
these functions only seem to match 1 specific search item. I want to make
sure a variable (say $mlsnumber) contains only numbers and no spaces. What
would I use to accomplish this?
Thanks
Ed
Ed Curtis wrote:
I've been looking at the docs and found preg_match and preg_match_all but
these functions only seem to match 1 specific search item. I want to make
sure a variable (say $mlsnumber) contains only numbers and no spaces. What
would I use to accomplish this?
Thanks
Ed
You really don't
John Nichel wrote:
Ed Curtis wrote:
I've been looking at the docs and found preg_match and preg_match_all but
these functions only seem to match 1 specific search item. I want to make
sure a variable (say $mlsnumber) contains only numbers and no spaces.
What
would I use to accomplish this?
--- Ed Curtis [EMAIL PROTECTED] wrote:
I've been looking at the docs and found preg_match and
preg_match_all but these functions only seem to match 1
specific search item. I want to make sure a variable (say
$mlsnumber) contains only numbers and no spaces. What
would I use to accomplish this?
8 matches
Mail list logo