blueshake 发表于 2010-11-18 07:58:00

[求助]正则表达式

请教各位大侠,如下程序(defun c:tt(/ regex lst)    (vl-load-com)(setq regex (vlax-create-object "Vbscript.RegExp"))(vlax-put-property regex "IgnoreCase" 0) (vlax-put-property regex "Global" 1);   (vlax-put-property regex "Pattern" ".*%%P([\d]+[\\\\.]?[\d]*).*")(setq string "<>%%P0.05gd")(setq result (vlax-invoke-method regex "Replace" string "$1"))   (princ result)(vlax-release-object regex)    )在AutoCAD中,总是输出"",
但是我在正则表达式测试工具中都是输出0.05请教大侠们原因,谢谢。

狂刀lxx 发表于 2010-12-20 01:45:02

本帖最后由 狂刀lxx 于 2010-12-20 01:45 编辑

(vlax-put-property
    regex
    "Pattern"
    ".*%%P([\\d]+[\\\\\\\\.]?[\\d]*).*"
)

lisp中 \\ 代表 \
页: [1]
查看完整版本: [求助]正则表达式