find and string types

Started by cormullion, August 06, 2006, 10:41:15 AM

Previous topic - Next topic

cormullion

I've forgotten why these two find expressions should give different results:



(set 't "       ; this is a comment")
(find "(s*)(;+?)(.*)" t 0)
(find {(s*)(;+?)(.*)} t 0)


I ought to know...

Lutz

#1
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.



> (find {(s*)(;+?)(.*)} t 0) ; only single backslash needed
0
> (find "(\s*)(;+?)(.*)" t 0) ;  double backslash necessary
0
>

 

Lutz

cormullion

#2
Of course. I knew that.... Well, i should have remembered. Thanks Lutz!