I want to count (within a single regular expression) all spaces at the beginning of a string.
My ideas:
$identSize = preg_match_all("/^( )[^ ]/", $line, $matches);
For example:
$example1 = " Foo"; // should return 1
$example2 = " Bar"; // should return 2
$example3 = " Foo bar"; // should return 3, not 4!
Any tips, how I can resolve it?
Or, if you want regular expression,