通配符参考wmatch说明,方便根据内容来快速筛选文字对象。
Wild-card characters
Character
Definition
# (pound)
Matches any single numeric digit.
@ (at)
Matches any single alphabetic character.
. (period)
Matches any single nonalphanumeric character.
* (asterisk)
Matches any character sequence, including an empty one, and it can be used anywhere in the search pattern: at the beginning, middle, or end.
? (question mark)
Matches any single character.
~ (tilde)
If it is the first character in the pattern, it matches anything except the pattern.
[...]
Matches any one of the characters enclosed.
[~...]
Matches any single character not enclosed.
- (hyphen)
Used inside brackets to specify a range for a single character.
, (comma)
Separates two patterns.
` (reverse quote)
Escapes special characters (reads next character literally).
- (defun c:qs (/ rt ss)
- (if (null *qs-text-pattern*)
- (setq *qs-text-pattern* "C#,M#,FM#")
- )
- (if (/= ""
- (setq rt (getstring (strcat "\n输入文字内容通配符 <\"" *qs-text-pattern* "\">: ")))
- )
- (setq *qs-text-pattern* rt)
- )
- (if (and
- (setq ss (ssget (list '(0 . "*TEXT") (cons 1 *qs-text-pattern*))))
- (= 0 (getvar "CMDACTIVE"))
- )
- (progn
- (sssetfirst nil ss)
- (princ (strcat "\n选择了 " (itoa (sslength ss)) " 个对象。"))
- )
- )
- (princ)
- )
|