Not trying to hijack the thread, but I have so many questions after trying an alternative approach:
Does anyone already came up with a handy subfoo like this? :
; _$ (rgxtest "d" "([A-Z]|[a-c]|[1-4])") -> :vlax-false
; _$ (rgxtest "hjk" "[a-c]") -> :vlax-false
; _$ (rgxtest "hjck" "[a-c]") -> :vlax-true
(defun rgxtest ( str rgxpat / _trapeval rgx r )
(setq _trapeval
(lambda (a b / c)
(setq c (vl-catch-all-apply (function (lambda (b) ((eval a) b))) (list b)))
(cond ( (vl-catch-all-error-p c) (prompt (strcat "\n" (vl-catch-all-error-message c))) ) (c))
)
)
(cond
( (not (setq rgx (_trapeval 'vlax-get-or-create-object "vbscript.regexp"))) )
(
(setq r
(_trapeval
(lambda (x)
(vlax-put-property rgx 'global actrue)
(vlax-put-property rgx 'multiline actrue)
(vlax-put-property rgx 'pattern rgxpat)
(vlax-invoke-method rgx 'Test str)
)
nil
)
)
)
); cond
(_trapeval 'vlax-release-object rgx) r
); defun rgxtest
What should be the correct regex pattern to match Marc's criteria? I tried:
_$ (rgxtest "preffix-x_-suffix" "([*])|(?:[Xx][_])")
:vlax-true
But thats not correct, due the preffix it should return :vlax-false.
What stands the wcmatch "*" (asteriks) substitute thats being used in regex "multiple times any characters"?
say implement this wcmatch filter as regex pattern: (wcmatch str "*H*")
Literal asteriks such as in wcmatch "`*" in regex is "[the_asteriks_symbol_here]" - right?