Using WCMATCH to find a comma?

Sage Cowsert

Usenet Archive
Joined
Jul 25, 2003
Messages
44
Reaction score
0
Ok so I want to search for "*,".

For example:

(setq TEMPLINE "ANNODARK,S-ANNO-DARK,3,CONTINUOUS,,ANNO")

(setq TEST "S-ANNO-DARK")

(wcmatch TEMPLINE (strcat "*," TEST ",*"))

Comes back I, ok now when I do this.

(setq TEST "S-ANNO-SHOULDNT-FIND-IT")

(wcmatch TEMPLINE (strcat "*," TEST ",*"))

Comes back T I want this to fail. How can I use the ',' in wcmatch?
 
Characters that have meanings in the pattern must
be escaped with the backquote (`).

This returns T if the string contains one or more commas:

(wcmatch "foo,bar" "*`,*")
 
The "reverse single quote" (`) is the required escape character; otherwise, a match to any of the substrings separated by the commas will return T. Use

(wcmatch TEMPLINE (strcat "*`," TEST "`,*"))
___
 
Back
Top