[Techtalk] Regular Expression Question
Bowen, Tricia
tbowen at CapitalThinking.com
Mon Oct 1 18:27:21 EST 2001
Hey Kai,
Thanks for responding. I actually figured out a
dirty perl way of doing it. Here goes:
tr/[A-Z/[a-z]/;
s/(^.)/\u$1/;
s/_(.)/\u$1/g;
--Tricia
-----Original Message-----
From: Kai MacTane [mailto:kmactane at GothPunk.com]
Sent: Monday, October 01, 2001 6:13 PM
To: techtalk at linuxchix.org
Subject: Re: [Techtalk] Regular Expression Question
At 10/1/01 02:44 PM , Bowen, Tricia wrote:
>Does anyone have a quick and dirty way of translating:
>
>MY_TABLE_NAME to MyTableName
>
>I know tr/[A-Z]/[a-z]/ will do half the job, but I
>need a way to make something like this
>s/(_.)/($1 =~ tr/[a-z]/[A-Z/)/; work.
Does it have to be a one-liner? Does it have to be a general regex, or can
it be expressed in Perl? I think I have something like this sitting around
somewhere, but it may be two or even three lines. (If that's okay.)
(I sometimes like to keep things multi-line, just for readability. And also
to combat Perl's reputation as a write-only language.)
Anyway, I can work on finding it while you answer and let me know if it
would even work for you.
--Kai MacTane
----------------------------------------------------------------------
"Deadly angels for reality and passion..."
--Shriekback,
"Gunning for the
Buddha"
_______________________________________________
Techtalk mailing list
Techtalk at linuxchix.org
http://www.linuxchix.org/mailman/listinfo/techtalk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://linuxchix.org/pipermail/techtalk/attachments/20011001/b58ca683/attachment.xhtml
More information about the Techtalk
mailing list