Re: Regex problem
| From: | Calin Uioreanu | Date: | Thu, 25 Oct 2001 08:59:37 +0000 |
| Subject: | Re: Regex problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72219@lists.php.net to get a copy of this message | ||
$sNoSpaces = ltrim($variable);
if ('*' == $sNoSpaces[0]) ....
--
Regards,
----------------------------------------------
Calin Uioreanu
calin@ciao-ag.com
Tel: +49 - (0) 89 - 25 55 17 23
http://www.ciao.com
----------------------------------------------
"Leon Mergen" <leon@blazebox.com> wrote in message
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