Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Re: Search for a character in CAPS

by grummerX (Pilgrim)
on Mar 07, 2002 at 10:37 UTC ( [id://149982]=note: print w/replies, xml ) Need Help??


in reply to Re: Search for a character in CAPS
in thread Search for a character in CAPS

Conversely, you could use \B to match a non-boundary. This would still take into account the beginning of the string, while also allowing for spaces within the string.
$agent = 'PerlBeginnerPerl AndAnother'; $agent =~ s/\B([A-Z])/ $1/g; # Produces 'Perl Beginner Perl And Another' $agent = 'PerlBeginnerPerl AndAnother'; $agent =~ s/\B([A-Z])/ $1/g; # Produces 'Perl Beginner Perl And Another'
I realize that spaces within the string is probably outside the scope of the original question, but \B covers his bases and might be a little easier for a beginner to grok than a look-ahead.

-- grummerX

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://149982]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (8)
As of 2024-04-24 11:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found