On 03/18/2005-10:35AM, Mike Hall wrote: > > > > A caret as the first charachter in a class is a negation. > > So this [^\s]+ means match one or more of any char that > > isn't whitespace. > > > > Ok, so the context of metas change within a class. That makes sense, > but I'm unclear on the discrepancy below. >
The ^ means begining of line EXCEPT inside a charachter class. There it means NOT for the entire class and it only means that if it is the very first charachter. I suppose you could consider that the there are two separate types of char classes. One is started with [ and the other is started with [^. > > > > > That would be \ > > > > Here's where I'm confused. From the Python docs: > > Special characters are not active inside sets. For example, [akm$] will > match any of the characters "a", "k", "m", or "$" > And the next paragraphs says... You can match the characters not within a range by complementing the set. This is indicated by including a "^" as the first character of the class; "^" elsewhere will simply match the "^" character. For example, [^5] will match any character except "5". _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor