On 08/08/06, Dave M G <[EMAIL PROTECTED]> wrote:

PHP,

Shouldn't this regular expression select everything from the start of
the string to the first space character:

$firstWord = preg_match('#^*(.*) #iU', $word);

It doesn't, so clearly I'm wrong, but here's why I thought it would:

. stands for any single character, not *. Also, # is the delimiter, but
you can use a variety of deliimters. The following should work:


^[\w\d]+\s{1}

^ start of line
[\w\d]+ range of any digits or letters, one or more
(\s{1}) exactly one whitespace character

hope this helps!




--
http://www.web-buddha.co.uk
http://www.projectkarma.co.uk

Reply via email to