I have a string that looks like: ... KPPET(L ATT)(I GAT)TTID ...
And I want to end up with a string that looks like: ... K P P E T (L ATT) (I GAT) T T I D ... Notice that there is a space in between each letter EXCEPT in the (X YYY) pattern where YYY has to stay together with NO intervening spaces. ( X YYY ) would be OK too. Right now, I am adding spaces in a loop: <cfset myString = "#ProteinSequence#"> <cfset myString_len = Len(myProteinSequence)> <cfloop from="#myString_len#" to="1" step="-1" index="i"> <cfset myProteinSequence = Insert(" ",myProteinSequence,i)> </cfloop> But this adds spaces everywhere, even where I don't want them , in the "YYY" pattern, so I get: ... K P P E T ( L A T T ) ( I G A T ) T T I D ... If I could do a "conditional insert" where it stops inserting a space when it hits the first ")" and start again after it hits the next "(" but I am not sure how to do it? Any ideas would be appreciated, otherwise I need to explore regular express replace with backreferences (maybe), which is a prospect too horrible to contemplate ... Richard Colman Institute for Genomics and Bioinformatics ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:190133 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations & Support: http://www.houseoffusion.com/tiny.cfm/54