Hello Leon,

try this

if (preg_match("/^([[:space:]]*)?\*/s", $string)) {
 echo "Match.";
} else {
 echo "No match";
}

James

"Leon Mergen" <[EMAIL PROTECTED]> wrote in message
002f01c15d2a$e4ca3030$012aa8c0@leon">news:002f01c15d2a$e4ca3030$012aa8c0@leon...
Hi there,

I am camping with a little regular expressions problem...

Problem: I want to check if $variable begins with a * (star), and it doesn't
matter if it starts with plenty of spaces...

My solution:
ereg("^[:space:]*\*",$variable)

But, it doesn't seem to work with the space part... The regex:

ereg("^\*",$variable)

does work, but that doesn't include spaces at the start... How can I extend
this one so that it doesn't matter if there are a lot of spaces at the
begin?

Thanks in advance,

Leon Mergen




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to