如何使用 Nant/Ant 命名模式? [英] How do I use Nant/Ant naming patterns?

查看:32
本文介绍了如何使用 Nant/Ant 命名模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不得不承认,我总是忘记 Nant 命名模式的句法内部结构(例如,在文件集中使用的那些).双星号/单星号的东西在我脑海中似乎很容易忘记.

I have to admit that I always forgot the syntactical intracacies of the naming patterns for Nant (eg. those used in filesets). The double asterisk/single asterisk stuff seems to be very forgettable in my mind.

有人可以提供有关命名模式的权威指南吗?

Can someone provide a definitive guide to the naming patterns?

推荐答案

规则是:

  • 单个星号 (*) 匹配路径名中的零个或多个字符
  • 双星 (**) 匹配零个或多个目录级别的字符
  • 问号 (?) 与路径名中的一个字符完全匹配

另一种思考方式是双星 (**) 匹配斜线 (/) 但单星 (*) 不匹配.

Another way to think about it is double star (**) matches slash (/) but single star (*) does not.

假设您有文件:

  1. bar.txt
  2. src/bar.c
  3. src/baz.c
  4. src/test/bartest.c

然后是模式:

  • *.c
  • *.c不匹配(当前目录中没有 .c 文件)
  • src/*.c     匹配 2 和 3
  • */*.c        匹配2和3(因为*只匹配一级)
  • **/*.c     匹配 2、3 和 4(因为 ** 匹配任意数量的级别)
  • bar.*        匹配 1
  • **/bar.*   匹配 1 和 2
  • **/bar*.* 匹配 1、2 和 4
  • src/ba?.c 匹配 2 和 3   
  • *.c             matches nothing (there are no .c files in the current directory)
  • src/*.c     matches 2 and 3
  • */*.c         matches 2 and 3 (because * only matches one level)
  • **/*.c       matches 2, 3, and 4 (because ** matches any number of levels)
  • bar.*         matches 1
  • **/bar.*   matches 1 and 2
  • **/bar*.* matches 1, 2, and 4
  • src/ba?.c matches 2 and 3    

这篇关于如何使用 Nant/Ant 命名模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆