Doesn't this mean replace zero or more occurrences of non-whitespace with the empty string?
If so, I don't see how the 3rd line of code will ever return anything but whitespace. Am I off the mark?
09-16-2009, 01:44 PM
scragar
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.
09-16-2009, 01:54 PM
romsok
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".