That's something confusing with regExps, the carat can either represent the start of a line(or in multiline mode the start of the whole string) OR mean not.
In general if it comes first it means the former, if it occurs later on it means the later, but there are several complex rules that define this.
If you are using PHP please use the [PHP] and [/PHP] forum tags for highlighting...
The same applies to HTML and the forums [HTML][/HTML] tags.
I read up on it - it seems that the big difference is whether the caret is used inside square brackets or outside. Inside it negates the character class. Outside it marks the beginning of the string. So in my example the expression means "trim all whitespace from the beginning of the line".