I'm trying to filter thousands of files, looking for those which contain string constants with mixed case. Such strings can be embedded in whitespace, but may not contain whitespace themselves. So the following (containing UC chars) are matches:
" AString " // leading and trailing spaces together allowed
"AString " // trailing spaces allowed
" AString" // leading spaces allowed
"newString03" // numeric chars allowed
"!stringBIG?" // non-alphanumeric chars allowed
"R" // Single UC is a match
but these are not:
"A String" // not a match because it contains an embedded space
"Foo bar baz" // does not match due to multiple whitespace interruptions
"a_string" // not a match because there are no UC chars
I still want to match on lines which contain both patterns:
"ABigString", "a sentence fragment" // need to catch so I find the first case...
I want to use Perl regexps, preferably driven by the ack command-line tool. Obviously, \w and \W are not going to work. It seems that \S should match the non-space chars. I can't seem to figure out how to embed the requirement of "at least one upper-case character per string"...
ack --match '\"\s*\S+\s*\"'
is the closest I've gotten. I need to replace the \S+ with something that captures the "at least one upper-case (ascii) character (in any position of the non-whitespace string)" requirement.
This is straightforward to program in C/C++ (and yes, Perl, procedurally, without resorting to regexps), I'm just trying to figure out if there is a regular expression which can do the same job.