glob pattern
来源:互联网 发布:windows打war包 编辑:程序博客网 时间:2024/06/13 02:03
节选自oracle官方文档
When the syntax is "glob
" then the String
representation of the path is matched using a limited pattern language that resembles regular expressions but with a simpler syntax. For example:
*.java
Matches a path that represents a file name ending in.java
*.*
Matches file names containing a dot*.{java,class}
Matches file names ending with.java
or.class
foo.?
Matches file names starting withfoo.
and a single character extension/home/*/*Matches /home/gus/data on UNIX platforms/home/**Matches /home/gus and /home/gus/data on UNIX platformsC:\\*Matches C:\foo and C:\bar on the Windows platform (note that the backslash is escaped; as a string literal in the Java Language the pattern would be "C:\\\\*")
The following rules are used to interpret glob patterns:
The
*
character matches zero or morecharacters
of aname
component without crossing directory boundaries.The
**
characters matches zero or morecharacters
crossing directory boundaries.The
?
character matches exactly one character of a name component.The backslash character (
\
) is used to escape characters that would otherwise be interpreted as special characters. The expression\\
matches a single backslash and "\{" matches a left brace for example.The
[ ]
characters are a bracket expression that match a single character of a name component out of a set of characters. For example,[abc]
matches"a"
,"b"
, or"c"
. The hyphen (-
) may be used to specify a range so[a-z]
specifies a range that matches from"a"
to"z"
(inclusive). These forms can be mixed so [abce-g] matches"a"
,"b"
,"c"
,"e"
,"f"
or"g"
. If the character after the[
is a!
then it is used for negation so[!a-c]
matches any character except"a"
,"b"
, or"c"
.Within a bracket expression the
*
,?
and\
characters match themselves. The (-
) character matches itself if it is the first character within the brackets, or the first character after the!
if negating.The
{ }
characters are a group of subpatterns, where the group matches if any subpattern in the group matches. The","
character is used to separate the subpatterns. Groups cannot be nested.Leading period/dot characters in file name are treated as regular characters in match operations. For example, the
"*"
glob pattern matches file name".login"
. TheFiles.isHidden(java.nio.file.Path)
method may be used to test whether a file is considered hidden.All other characters match themselves in an implementation dependent manner. This includes characters representing any
name-separators
.The matching of
root
components is highly implementation-dependent and is not specified.
- glob pattern
- 飘逸的python - 实现glob style pattern
- glob
- glob
- glob
- glob
- python glob.glob使用
- glob模块
- glob模块
- glob 通配符
- glob 模块
- glob模式
- Glob通配符
- php glob
- nodejs glob
- glob模式
- glob patterns
- glob模式
- 【c++】通过示例详细说明类的声明
- 指纹识别
- 网海茫茫,有你最暖
- 表达式求值
- iOS错误信息记录,不定时补充
- glob pattern
- 暴力解决配置HTTPS后无法使用Hermit
- poj_1679 The Unique MST(次小生成树)
- 有没有对JS比较熟悉的?
- git基础(二)-版本回退
- 定位问题
- [排序算法]--桶排序的Java实现
- SSM_Web.xml 2.5 声明头配置
- 存储过程拆分字符串