This is the new home of the egghelp.org community forum. this announcement post . Click the X in the top right-corner of this box to dismiss this message. 
Old posts that have not been replied to for several years.
			
		
				
			
				
																B 														
								Baerchen  
									
						
		
						
						
		 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Baerchen  Wed Sep 26, 2001 4:26 am 
			
			
			
			
			
			Hi, 
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								stdragon 							 
						Owner 			
		Posts:  959 Joined:  Sun Sep 23, 2001 8:00 pm
				Contact: 
				
			 
				
		 
		
						
					
						 
													
							
						
									
						Post 
					 
								by stdragon  Wed Sep 26, 2001 10:25 pm 
			
			
			
			
			
			You could do it with one regsub and a subst. It's probably better to just do 2 regsubs though 
set str "this is 1 test of 2 things"
set keys(1) one
set keys(2) two
regsub -all 1|2 $str {${keys(&)}} str
set str [subst $str]
Just make sure your source string doesn't have special characters in it 
 
		 
				
		
		 
	 
				
		
				
			
				
																B 														
								Baerchen  
									
						
		
						
						
		 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Baerchen  Fri Sep 28, 2001 3:44 pm 
			
			
			
			
			
			Hmm, thanks a lot.
			
			
									
						
										
						 
		 
				
		
		 
	 
				
		
				
			
				
								Petersen 							 
						Owner 			
		Posts:  685 Joined:  Thu Sep 27, 2001 8:00 pmLocation:  Blackpool, UK 
		
						
					
						 
													
							
						
									
						Post 
					 
								by Petersen  Fri Sep 28, 2001 8:08 pm 
			
			
			
			
			
			personally i just like to write a proc for such things
eg
Code: Select all 
proc myregsub {a} {
regsub -all 1 $a one a 
regsub -all 2 $a two a
return a
}
can then just regsub a string by doing [myregsub $blah] etc