Re: Quick Regex Question
| From: | CC Zona | Date: | Tue, 06 Mar 2001 04:53:39 +0000 |
| Subject: | Re: Quick Regex Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42701@lists.php.net to get a copy of this message | ||
In article <NDBBJKNCILKDCEGAJBAOEENIDFAA.jeff@webdesigns1.com>,
jeff@webdesigns1.com ("Jeff Oien") wrote:
> if (preg_match("/[a-Z],[a-Z]/",$text)) {
>
> Can you tell me where I'm failing here. I want to do something
> if the string has commas in between words with no spaces.
> Like:
>
> blah,blah,blah
"Does it have *any instance where a string of letters is separated only by
a comma?" preg_match("/[a-z]+,[a-z]+/i",$text)
"Does it consist *entirely of strings of letters separated only by comma?"
preg_match("/^[a-z]+,[a-z]+$/i",$text)
--
CC