本帖最后由 llsheng_73 于 2014-12-16 14:55 编辑
- (defun mtext2txt(s / ob)
- (vlax-put-property(setq ob(vlax-create-object"Vbscript.RegExp"))"IgnoreCase"0)
- (vlax-put-property ob "Global" 1)
- (setq s(mapcar'(lambda(x y)(vlax-put-property ob"Pattern"x)(setq s(vlax-invoke-method ob"Replace"s y)))
- '("\\\\\\\\""\\\\{""\\\\}""\\\\pi(.[^;]*);""\\\\pt(.[^;]*);""\\\\S(.[^;]*)(\\^|#|\\\\)(.[^;]*);"
- "(\\\\F|\\\\f|\\\\C|\\\\H|\\\\T|\\\\Q|\\\\W|\\\\A)(.[^;]*);""(\\\\L|\\\\O|\\\\l|\\\\o)""\\\\~"
- "\\\\P" "\n" "({|})" "\\x01" "\\x02" "\\x03")(list(CHR 1)(CHR 2)(CHR 3)"""""""""""" (chr 13) "" "" "\\" "{" "}")))
- (if ob(vlax-release-object ob))
- (last s))
这是根据MCCAD的修改的,其中换行符替换为(chr 13)是因为我有特殊用途,如果用不着,可以把它替换为"" |