[thelist] Parsing camelcase text

Matt McKeon matt at camadro.com
Mon Jan 12 10:49:20 CST 2009

misterhaan wrote:
> Matt McKeon wrote:
>> I thought the .*? bit would have caught the next characters, but
>> apparently not.
> the dot means any character, the star means any number of the previous 
> character, and the question mark after the star means the shortest 
> possible match.  so .*? will always match a 0-length string.  instead of 
> .*? i'd probably go for [^A-Z]* for any number of characters that aren't 
> capital letters.
Ah, ok. I knew about non-greedy mode using a ?, but didn't think it
would match 0-length strings.
Yay, ([A-Z][^A-Z]*) works great!

More information about the thelist mailing list