Showing posts with label glob. Show all posts
Showing posts with label glob. Show all posts

Friday, September 21, 2007

关于Shell中的模式(glob)与正则表达式(Regular Expression)

不要将正则表达式和 shell 中的文件名匹配模式,globs 混淆了。通常 glob 是指,在 Unix shell 下输入*.pm 将匹配所有结尾为.pm 的文件名,globs 有时也被称作模式。但严重的问题是,某些面向初级用户的书籍(可能是菜鸟写得)将 globs 叫做“正则表达式”,这绝对是错误的。
Ruby中Dir Class 中有个方法[],说明为:Equivalent to calling Dir.glob(glob_pattern, 0),而在Dir.glob方法中则有二种用法:
Dir.glob( glob_pattern,