The issue is that you can't specify a replacement like that. You are
effectively replacing every match with "$1".toUpperCase(), which
(since .toUpperCase() doesn't do anything with '$' or '1') just replaces
it with '$1'--the original lowercase match. What you want is to use the
second version of replace, where you provide a function to get the
replacement (see examples at
http://livedocs.adobe.com/flex/3/langref/String.html#replace() ).
-- 
Maciek Sakrejda
Truviso, Inc.
http://www.truviso.com

-----Original Message-----
From: jimmy5804 <jimmy5...@yahoo.com>
Reply-to: flexcoders@yahoogroups.com
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Perplexing regex/replace() issue
Date: Mon, 16 Mar 2009 17:44:55 -0000

put I don't control with a lot of properties that look like "xx-yyy"
that I want to camelcase: "xxYyy" and I'd like to do this with a
one-line replace() instead of a longer split/join approach. I've tried
several variations of:

var s:String = t.replace(/-([a-z])/g, "$1".toUp


Reply via email to