bitt3n Posted August 15, 2011 Share Posted August 15, 2011 in the following, I want put only 'Capitalized Words' into a group. text="ALL CAPITAL LETTERS - Capitalized Words" the best way to do it seems to use the logic: "match everything until the following character is lowercase, then put the current and following characters in a group, stopping at the final quotation mark" to do this I've tried text="(.(?![a-z]))+(?<mygroup>[^"]+)" which I understand to mean "match at least one of anything that isn't followed by a lowercase character, then make the group" however I've clearly screwed something up. What did I do wrong? Quote Link to comment Share on other sites More sharing options...
.josh Posted August 15, 2011 Share Posted August 15, 2011 maybe need to rephrase or give more explanation or more context or somethin' because as-is, your regex works, in that you get "Capitalized Words" in "mygroup" Array ( [0] => text="ALL CAPITAL LETTERS - Capitalized Words" [1] => [mygroup] => Capitalized Words [2] => Capitalized Words ) Quote Link to comment Share on other sites More sharing options...
bitt3n Posted August 15, 2011 Author Share Posted August 15, 2011 ha I realized I forgot to remove the case insensitive modifier I was using for another part of the regex, cosmic level idiocy Quote Link to comment Share on other sites More sharing options...
bitt3n Posted August 15, 2011 Author Share Posted August 15, 2011 edit: double post Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.