Using WCMATCH to find a comma?

Discussion in 'AutoCAD' started by Sage Cowsert, Sep 16, 2003.

  1. Sage Cowsert

    Sage Cowsert Guest

    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?
     
    Sage Cowsert, Sep 16, 2003
    #1
  2. 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" "*`,*")
     
    Tony Tanzillo, Sep 16, 2003
    #2
  3. Sage Cowsert

    Paul Turvill Guest

    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 "`,*"))
    ___
     
    Paul Turvill, Sep 16, 2003
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.