note
Crian
<p>
> But I can't understand why it doesn't work if you put the \s* outside the parens, nor I can understand why it stops working if I put the \s*$ at the end of the regex :-(
</p>
<p>
That is because if you have the string
</p>
<code>
root: admin@somewhere.here
11111233333333333333333333
</code>
<p>
and the RE
</p>
<code>
/^root:\s*(?!\s*admin\@somewhere\.here)/
ABBBBBCCC
</code>
<p>
then the part A in the RE matches the beginning of the string, part BBBBB matches 11111 ("root:") and CCC matches an empty string (not a space, a string with zero chars in it). After this empty string follows a space, and the space is not the beginning of "admin@somewhere.here", because it is the beginning of " admin@somewhere.here".
</p>
<p>I hope things are getting clearer for you :-)</p>
390074
390086