正则表达式匹配像这样的文件名 [英] Regular expression to match a file name like this

查看:100
本文介绍了正则表达式匹配像这样的文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要在C#中使用正则表达式,因为字符串以W开头,然后是00,然后是5个数字,之后它可以是字母或数字,但有些东西会存在。这个W00和5个数字都很重要。



就像所有匹配的字符串一样:W00235678MCHWIL或者:W002356782158



有点紧急。



提前致谢



我尝试了什么:



在线搜索朋友等

Hi All,

I need a regular expression in C#, for string which starts with W then "00" then 5 numbers, after that it can be letters or numbers but something will be there. This W00 and 5 numbers is every important.

Just like all the strings which match, either this: W00235678MCHWIL or this: W002356782158

Its little bit urgent.

Thanks in advance please

What I have tried:

Searching online asking friends etc

推荐答案

尝试一下喜欢:

Try something like:
^W00\d{5}.



Regexper [ ^ ]

正则表达式语言 - 快速参考 [ ^ ]


试试这篇文章;



30分钟正则表达式教程 [ ^ ]
Try this article;

The 30 Minute Regex Tutorial[^]


以下是RegEx文档的链接:

perlre - perldoc.perl.org [ ^ ]

以下是帮助构建RegEx并调试它们的工具的链接:

.NET Regex Tester - Regex Storm [ ^ ]

Expresso正则表达式工具 [ ^ ]

这个显示RegEx是一个很好的图表,它非常有助于理解RegEx的作用:

Debuggex:在线可视正则表达式测试器。 JavaScript,Python和PCRE。 [ ^ ]
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[^]
Expresso Regular Expression Tool[^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[^]


这篇关于正则表达式匹配像这样的文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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