Excerpt from the help:
Note: Because additional wild-card characters might be added in future releases of AutoLISP, it is a good idea to escape all non-alphanumeric characters in your pattern to ensure upward compatibility.
Also, all characters enclosed in brackets ([ . . . ]) are read literally, so there is no need to escape them.
Accordingly this will work (and is more eye friendly to me) as well as the "*-` pippo*" variant:
(progn
(setq tests
'(
"ciao come stai - pippo"
"ciao come stai - pippo"
"ciao come stai - pippo"
"ciao come stai - pippo"
"ciao come stai - pippo "
)
)
(setq pattern "*-[ ]pippo*")
(foreach test tests
(princ
(strcat
"\n"
(vl-prin1-to-string test)
": "
(if (wcmatch test pattern) "T" "nil")
)
)
)
(princ)
)
>>
"ciao come stai - pippo": T
"ciao come stai - pippo": nil
"ciao come stai - pippo": nil
"ciao come stai - pippo": T
"ciao come stai - pippo ": T
Cheers/Ciao.