<update>

Untested code rocks. :) dvergin is absolutely correct, this code will not work. I will leave it as is, to serve as a warning to others about posting without testing. Thanks for the lesson, dvergin. :)

And now back to our regular show...

</update>

I would try something like:

$agent =~ s/.([A-Z])/ $1/g;
Which should insert a space in front of each capital letter, except if it is at the start of the string (the dot makes sure there must be at least one letter of any kind in front of the matched uppercase letter).

If you don't want to insert when there are capital letters standing together, like in CIA => C I A, you could try something like:

$agent =~ s/[^A-Z]([A-Z])/ $1/g;
Which should make sure it matches an uppercase letter, that is preceded with anything but an uppercase letter.

Hope I understood the question correctly. :)


You have moved into a dark place.
It is pitch black. You are likely to be eaten by a grue.

In reply to Re: Search for a character in CAPS by Dog and Pony
in thread Search for a character in CAPS by c_lhee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.