[英]Regex for file name in a directory
I have two files in a directory. 我的目录中有两个文件。
FileAbc_1.xml
and FileAbc.xml
. FileAbc_1.xml
和FileAbc.xml
。 I want write a regex that only select FileAbc_1.xml
. 我想编写一个仅选择
FileAbc_1.xml
的正则表达式。
My regex is : FileAbc.*.xml
我的正则表达式是:
FileAbc.*.xml
It is picking up both file names but I only want FileAbc_1.xml
. 它正在选择两个文件名,但是我只想要
FileAbc_1.xml
。 Any help would great favor. 任何帮助都会大有帮助。
这将为您工作FileAbc_ [0-9] +。xml
That should just be: FileAbc_\\d\\.xml
那应该是:
FileAbc_\\d\\.xml
(assuming there's never more than one digit after the underscore) (假设下划线后的位数不超过一位数)
您可以将其用于任何以FileAbc开头并以XML FileAbc.+\\.xml
结尾的内容。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.