Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- eregi whitespace detection problem
October 30, 2004, 8:53 pm
rate this thread
Set up this test:
echo "<br>example 1:".intval(eregi("^\s","teststring"));
echo "<br>example 2:".intval(eregi("^\s","test string"));
Both resulting in 0 (zero)
also tried [:space:] and [:blank:] without result
Who can help this regular newbie expressing himself ?
Re: eregi whitespace detection problem
Which is correct. Your pattern is looking for:
^ - start of line
\s - followed by the literal string 's'
echo "<br>example 3:".intval(eregi("^\s","string test"));
Because that does start with an 's'.
For starters don't use ereg, use the preg functions, they're better for
It looks like you're already trying to use Perl-compatible expressions, since
you used \s. This would work if you used preg_match, as \s means whitespace in
Perl-compatible expressions, but not in POSIX expressions (as used by ereg).
You then just need to remove the leading ^.
<http://www.andyhsoftware.co.uk/space Space: disk usage analysis tool