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? Link to comment https://forums.phpfreaks.com/topic/244868-whats-causing-this-lookahead-to-fail/ 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 ) Link to comment https://forums.phpfreaks.com/topic/244868-whats-causing-this-lookahead-to-fail/#findComment-1257901 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 Link to comment https://forums.phpfreaks.com/topic/244868-whats-causing-this-lookahead-to-fail/#findComment-1257913 Share on other sites More sharing options...
bitt3n Posted August 15, 2011 Author Share Posted August 15, 2011 edit: double post Link to comment https://forums.phpfreaks.com/topic/244868-whats-causing-this-lookahead-to-fail/#findComment-1257914 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.