in reply to Looking for a regex to match last capitalized word in string

Two alternative solutions, saving all the string components.

The first solution will create an array of the distinct words composing the string.
The second one will also separate the initial letter. Is it needed? I don't know, but just in case :-).
$_="ConfigState"; my @words= split /([A-Z][^A-Z\s]+)$/,$_; print @words[-1], "\n"; # prints "State" # @words = qw(Config State) @words= split /([A-Z])/,$_; print @words[-2,-1], "\n"'; # It's a trick, but it prints "State" # @words = qw(C onfig S tate)