2008-05-04
Word通配符查找详解(Wildcards)
Word Wildcards查找与通常的正则表达式查找有一些区别,正则表达式大家都比较熟悉,而且资料也很多,下面详细介绍一下Word Wildcards查找。
打开Word,选中Edit menu,点击Find or Replace,选中Use wildcards复选框。
通配符使用规则如下:
任意单个字符
键入 ?
例如,s?t 可查找“sat”和“set”。
任意字符串
键入 *
例如,s*d 可查找“sad”和“started”。
单词的开头
键入 <
例如,<(inter) 查找“interesting”和“intercept”,但不查找“splintered”。
单词的结尾
键入 >
例如,(in)> 查找“in”和“within”,但不查找“interesting”。
指定字符之一
键入 [ ]
例如,w[io]n 查找“win”和“won”。
指定范围内任意单个字符
键入 [-]
例如,[r-t]ight 查找“right”和“sight”。必须用升序来表示该范围。
中括号内指定字符范围以外的任意单个字符
键入 [!x-z]
例如,t[!a-m]ck 查找“tock”和“tuck”,但不查找“tack”和“tick”。
n 个重复的前一字符或表达式
键入 {n}
例如,fe{2}d 查找“feed”,但不查找“fed”。
至少 n 个前一字符或表达式
键入 {n,}
例如,fe{1,}d 查找“fed”和“feed”。
n 到 m 个前一字符或表达式
键入 {n,m}
例如,10{1,3} 查找“10”、“100”和“1000”。
一个以上的前一字符或表达式
键入 @
例如,lo@t 查找“lot”和“loot”。
特殊意义的字符
键入 \
例如,f[\?]t 查找“f?t”
( )
对查询结果没有影响,是一个替换时分组的概念
例子:
用\2 \1替换(John) (Smith),得到结果Smith John
即\1代表John,\2代表Smith
^
特殊字符查询
Paragraph mark (¶)
Type ^p (doesn’t work in the Find what box when wildcards are on)
Tab character (→)
Type ^t
ANSI or ASCII characters
Type ^0nnn, where nnn is the character code
Em dash ( — )
Type ^+
En dash ( – )
Type ^=
Caret character
Type ^^
Manual line break (i)
Type ^l
Column break
Type ^n
Manual page break
Type ^m (also finds or replaces section breaks when wildcards are on)
Nonbreaking space (°)
Type ^s
Nonbreaking hyphen (-)
Type ^~
Optional hyphen ({)
Type ^-
Code that works in the Find what box only (when wildcards are on)
Graphic
Type ^g
Codes that work in the Find what box only (when wildcards are off)
Any character
Type ^?
Any digit
Type ^#
Any letter
Type ^$
Footnote mark
Type ^f
Endnote mark
Type ^e
Field
Type ^d
Section break
Type ^b
White space
Type ^w (any combination of regular and nonbreaking spaces, and tab characters)
Codes that work in the Replace with box only
Windows Clipboard contents
Type ^c
Contents of the Find what box
Type ^&
打开Word,选中Edit menu,点击Find or Replace,选中Use wildcards复选框。
通配符使用规则如下:
任意单个字符
键入 ?
例如,s?t 可查找“sat”和“set”。
任意字符串
键入 *
例如,s*d 可查找“sad”和“started”。
单词的开头
键入 <
例如,<(inter) 查找“interesting”和“intercept”,但不查找“splintered”。
单词的结尾
键入 >
例如,(in)> 查找“in”和“within”,但不查找“interesting”。
指定字符之一
键入 [ ]
例如,w[io]n 查找“win”和“won”。
指定范围内任意单个字符
键入 [-]
例如,[r-t]ight 查找“right”和“sight”。必须用升序来表示该范围。
中括号内指定字符范围以外的任意单个字符
键入 [!x-z]
例如,t[!a-m]ck 查找“tock”和“tuck”,但不查找“tack”和“tick”。
n 个重复的前一字符或表达式
键入 {n}
例如,fe{2}d 查找“feed”,但不查找“fed”。
至少 n 个前一字符或表达式
键入 {n,}
例如,fe{1,}d 查找“fed”和“feed”。
n 到 m 个前一字符或表达式
键入 {n,m}
例如,10{1,3} 查找“10”、“100”和“1000”。
一个以上的前一字符或表达式
键入 @
例如,lo@t 查找“lot”和“loot”。
特殊意义的字符
键入 \
例如,f[\?]t 查找“f?t”
( )
对查询结果没有影响,是一个替换时分组的概念
例子:
用\2 \1替换(John) (Smith),得到结果Smith John
即\1代表John,\2代表Smith
^
特殊字符查询
Paragraph mark (¶)
Type ^p (doesn’t work in the Find what box when wildcards are on)
Tab character (→)
Type ^t
ANSI or ASCII characters
Type ^0nnn, where nnn is the character code
Em dash ( — )
Type ^+
En dash ( – )
Type ^=
Caret character
Type ^^
Manual line break (i)
Type ^l
Column break
Type ^n
Manual page break
Type ^m (also finds or replaces section breaks when wildcards are on)
Nonbreaking space (°)
Type ^s
Nonbreaking hyphen (-)
Type ^~
Optional hyphen ({)
Type ^-
Code that works in the Find what box only (when wildcards are on)
Graphic
Type ^g
Codes that work in the Find what box only (when wildcards are off)
Any character
Type ^?
Any digit
Type ^#
Any letter
Type ^$
Footnote mark
Type ^f
Endnote mark
Type ^e
Field
Type ^d
Section break
Type ^b
White space
Type ^w (any combination of regular and nonbreaking spaces, and tab characters)
Codes that work in the Replace with box only
Windows Clipboard contents
Type ^c
Contents of the Find what box
Type ^&







评论排行榜