Had to look up what the \B represented. "\B matches at any position between two word characters as well as at any position between two non-word characters."
holy crap that is really cool :) On Thu, Mar 19, 2009 at 3:11 PM, Peter Boughton <[email protected]> wrote: > > >Of course, this is usually where somebody proves me wrong and posts > >something really cool > > My pleasure... ;) > > <cffunction name="ListFromChars" returntype="String" output="false"> > <cfargument name="Text" type="String"/> > <cfargument name="Delimiter" type="String" default=","/> > <cfreturn Arguments.Text.replaceAll( '\B' , Arguments.Delimiter ) /> > </cffunction> > > <cfdump var=#ListFromChars('abcdef')# /> > > > Can also use CF rereplace: > <cfreturn rereplace(Arguments.Text , '\B' , Arguments.Delimiter , > 'all' ) /> > > > These will work fine if the string is only alphanumerics - will need a > bigger expression if the string might contain other stuff. > > Like this: > > <cfreturn Arguments.Text.replaceAll( '\B|(?<!^)\b(?!$)' , > Arguments.Delimiter ) /> > > (that one doesn't have a CF equivalent, since CF regex can't do lookbehind) > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320725 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

