in reply to Parsing CamelCase words

my @words = /([A-Z][a-z]*)/g;

You didn't specify how to handle identifiers like "DBHandle".

Replies are listed 'Best First'.
Re^2: Parsing CamelCase words
by kyte (Initiate) on Jun 12, 2009 at 21:24 UTC
    I just want words like CamelKyte from the string that I have got from a file

      Ah, I thought you wanted to extract the words from the identifier, not extract the identifiers from the surrounding text.

      Take my existing code to detect CamelCased words, and find repetitions of it:

      @cc_words = /((?:[A-Z][a-z]*)+)/g;

      If you don't want words that are all uppercase, it's easiest to just filter them out:

      @cc_words = grep /[a-z]/, /((?:[A-Z][a-z]*)+)/g;

      If you don't want CamelCase words with only one upper case letter, change the "+" to "{2,}".

        So would this work if($inp_line =~ /PDSCLI/ || $inp_line =~ /TTOOL/) { print $inp_line; $inp_line=/((?:A-Za-z*)+)/g; } inp_line would have CamelCase words?