Jack Timmons wrote: > On Mon, Jan 12, 2009 at 9:29 AM, misterhaan <misterhaan at track7.org> 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. >> -- >> >> > > Sorry for the wait, craziness at work. > > $pattern = "/([A-Z][a-z0-9]+)/"; > $string = "MyTestString"; > > preg_match_all($pattern, $string, $matches); > print_r($matches); > > That should do it. Couldn't test it before, sorry. > > Note: That doesn't catch special characters, FYI. Let me know if what you > need changes. > > -Jack > > Thanks Jack for your help, that pattern works now! I'm only concerned with letters anyway.