For the Compleat Fan
			
		
		
			
				
																			
								cormullion 							 
									
		Posts:  2038  		Joined:  Tue Nov 29, 2005 8:28 pm 		
		
																Location:  latiitude 50N longitude 3W 
							
							
				Contact: 
				
			 
				
		 
		
						
						
													
							
						
									
						Post 
					 
								by cormullion   »  Sun Aug 06, 2006 5:41 pm 
			
			
			
			
			I've forgotten why these two 
find  expressions should give different results:
Code: Select all 
(set 't "       ; this is a comment")
(find "(\s*)(;+?)(.*)" t 0) 
(find {(\s*)(;+?)(.*)} t 0) 
I ought to know...
 
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
		
			
				
																			
								Lutz 							 
									
		Posts:  5289  		Joined:  Thu Sep 26, 2002 4:45 pm 		
		
																Location:  Pasadena, California 
							
							
				Contact: 
				
			 
				
		 
		
						
						 
													
							
						
									
						Post 
					 
								by Lutz   »  Sun Aug 06, 2006 8:09 pm 
			
			
			
			
			In the first one, which is delimited by quotes you would have to escape the backslash with another backslash, which is not necessary in the second one, which is delimited by curly braces. Curly braces suppress pre processing and take the characters literally.
Code: Select all 
> (find {(\s*)(;+?)(.*)} t 0) ; only single backslash needed
0
> (find "(\\s*)(;+?)(.*)" t 0) ;  double backslash necessary
0
> 
 
 
Lutz
 
			
			
									
									
						 
		 
				
		
		 
	 
	 
				
		
		
			
				
																			
								cormullion 							 
									
		Posts:  2038  		Joined:  Tue Nov 29, 2005 8:28 pm 		
		
																Location:  latiitude 50N longitude 3W 
							
							
				Contact: 
				
			 
				
		 
		
						
						 
													
							
						
									
						Post 
					 
								by cormullion   »  Sun Aug 06, 2006 10:44 pm 
			
			
			
			
			Of course. I knew that.... Well, i should have remembered. Thanks Lutz!