Dave M G 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: > > The enclosing has marks, "#", I *think* just encloses the expression. I > was told to use them before, but I can't find them here: > http://jp2.php.net/manual/en/reference.pcre.pattern.syntax.php > > The caret, "^", says to start at the beginning of the line. > > The first asterix, "*" after the caret says to use any starting character. Here's where you go wrong. The * means match the previous character 0 or more times. In this case I'm actually not sure what it would do. Given that you grab everything with the (.*) the first * is not needed at all. David -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php