Re: preg_match help please
| From: | Jasper Bryant-Greene | Date: | Thu, 08 Sep 2005 08:27:29 +0000 |
| Subject: | Re: preg_match help please | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-222014@lists.php.net to get a copy of this message | ||
Steve Turnbull wrote:
On Thu, 08 Sep 2005 19:27:49 +1200, Jasper Bryant-Greene wrote:That's what the \w* means. That means "0 or more word-characters", as opposed to \w+ which means "1 or more word-characters. The $ after that means "end of string" which makes sure that it's the last thing in the string. In other words, \w* means some word-characters, or nothing at all. You'd need to handle the newline in much the same way. The URL I gave you should help out a lot with that. -- Jasper Bryant-Greene Freelance web developer http://jasper.bryant-greene.name/ If you find my advice useful, please consider donating to a poor student! You can choose whatever amount you think my advice was worth to you. http://tinyurl.com/7oa5sSomething like '/^\w+,\w+,\w*$/' maybe? (untested) http://php.net/reference.pcre.pattern.syntaxThats got me a lot further - thanks I reduced it slightly to '/^\w+,\w+,' because at the end there is the possibility of an alpha-numeric character(s) OR nothing at all with the exception of a possible line break (note possible) It's the 'possibly nothing at all' which I am slightly stuck on