• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Using \U \L in regular expressions
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using \U \L in regular expressions


  • Subject: Re: Using \U \L in regular expressions
  • From: email@hidden (Randal L. Schwartz)
  • Date: Fri, 14 Aug 2009 08:06:36 -0700

>>>>> "Mark" == Mark J Reed <email@hidden> writes:

Mark> $ perl -pe 's/(.)(.*)/\1\L\2/' <<<HELLO ==> Hello

This is of course, doing it the hard way.
Much easier:

perl -pe 's/(.*)/\u\L$1/'

Yes, the \L lowercases everything, but the \u uppercases just the
first character of *that*.  Nice.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<email@hidden> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Using \U \L in regular expressions
      • From: Doug McNutt <email@hidden>
References: 
 >Using \U \L in regular expressions (From: Tim Mansour <email@hidden>)
 >Re: Using \U \L in regular expressions (From: Emmanuel LEVY <email@hidden>)
 >Re: Using \U \L in regular expressions (From: Tim Mansour <email@hidden>)
 >Re: Using \U \L in regular expressions (From: "Mark J. Reed" <email@hidden>)

  • Prev by Date: Re: Using \U \L in regular expressions
  • Next by Date: Strange Finder error
  • Previous by thread: Re: Using \U \L in regular expressions
  • Next by thread: Re: Using \U \L in regular expressions
  • Index(es):
    • Date
    • Thread