Re: ereg / regexp fun
| From: | Steven Werby | Date: | Wed, 16 Aug 2000 15:49:08 +0000 |
| Subject: | Re: ereg / regexp fun | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-12036@lists.php.net to get a copy of this message | ||
Dieter Kneffel <data@wap4.com> wrote:
> What is the correct regexp that matches a blank or the beginning of a
> string?
> What is the correct regexp that matches a blank or the end of a string?
" " matches a space. [[:space:]] matches any whitespace character (including
newline, etc.). [^ ] matches a space at the beginning. [ $] matches a space at
the end of a string. But you don't want to match a space at the beginning or
end.
ereg(" :([a-z] {1}) ", $msg, $item)
Then $item[1] will contain the letter you're looking for.
--
Steven Werby {steven-lists@befriend.com}
President, Befriend Internet Services LLC
http://www.befriend.com/ 804-355-WEBS