in reply to Re: Parsing CamelCase words
in thread Parsing CamelCase words

I just want words like CamelKyte from the string that I have got from a file

Replies are listed 'Best First'.
Re^3: Parsing CamelCase words
by ikegami (Patriarch) on Jun 12, 2009 at 21:28 UTC

    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?

        [ Please use <c>..</c> around code and other preformatted text. ]

        No. //g would only work properly if it's evaluated in list context.

        You've proven quite poor at specifying what you want, which is probably why you are having problems implementing it. Try to spend some effort there.

        Starting now. $inp_line is a scalar. How do you want to place multiple words into a scalar?