Le mardi 10 mars 2009, Harnack Frank a écrit :
> Hello Felix,
>
> I'm more confident with "^\s*" (or better "^\s+") too.
>
> I prefer "^\s+", because it only matches with really existing spaces.
>
> Maybe "\s*" works like this:
>
> - Not existing whitespaces at the beginning of the line matches with
> "\s*".
> - The not existing whitespaces are replaced with "".
> - Nothing is done.
>
Exactly. The "*" means "0 or more". The regex engine will stop at the first
occurence, and "\s*" means "find 0 spaces or more". Anywhere in the line
where there is 0 or more spaces will match, even lines without no leading
space-like characters.
So, I was wrong. The only benefit of anchoring the regex with ^, like I
suggested, is that most regex engines know that such a regex won't match
anywhere other than the beginning of a line. But this has no influence in
this particular case.
Sorry for the misguided advice,
--
Francis Galiegue
ONE2TEAM
Ingénieur système
Mob : +33 (0) 6 83 87 78 75
Tel : +33 (0) 1 78 94 55 52
fge@...
40 avenue Raymond Poincaré
75116 Paris
---------------------------------------------------------------------
To unsubscribe, e-mail:
user-unsubscribe@...
For additional commands, e-mail:
user-help@...