in reply to Re: regexps
in thread Looking for a regex to match last capitalized word in string
You could collapse the above code into a one-liner: print+(/[A-Z][^\WA-Z]*/g)[-1],$/for"siteConfigView","siteConfigDelete (with ws and lc extras) " --Davefor ("siteConfigView", "siteConfigDelete (with ws and lc extras) ") { my $last = (/([A-Z][^\WA-Z]*)/g)[-1]; print "$last\n"; }
|
---|