正则表达式在C ++ visual studio 2010中 [英] Regex in C++ visual studio 2010
本文介绍了正则表达式在C ++ visual studio 2010中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想了解如何使用visual studio 2010在C ++中使用regEx.
我有以下要求。
Hi,
I wanted to understand how can I use regEx in C++ using visual studio 2010.
I have below requirements.
RegEx : [0−9]{3}[0−9a−zA−Z]{3} [0−9a−zA−Z]{2} [0−9] //Regular expression,
Here there is range of valid chars in [] and value inside {} denotes the number of charactes that should comply with rule.
[0-9]{3} means that first three charcters of string should be a number in range 0 to 9.
[0−9a−zA−Z]{3} means that next 3 chars of string can be anything in range 0-9 or a-z ot A-Z.
以下是考虑上述规则的有效和无效字符串。
Below are valid and invalid strings considering above rule.
120 aBZ K8 7 - Valid
AX0 aBZ K8 7 - Not Valid
120 @1k0 _1 _ - Not valid
120 1BZ 18 7 - Valid
任何帮助表示赞赏。
我尝试了什么:
检查了几个博客,但我找不到任何符合我在c ++ for visual studio 2010中实现的要求。
Any help is appreciated.
What I have tried:
checked few blogs but i could not find anything for my requirements implemented in c++ for visual studio 2010.
推荐答案
如果有疑问,谷歌: regex c ++ - Google搜索 [ ^ ]
前4个链接全部涵盖了您的需求:
<regex> - C ++参考a> [ ^ ]
C ++ 11正则表达式教程Solarian程序员 [ ^ ]
正则表达式库 - cppreference.com [ ^ ]
规范表达式(C ++) [ ^ ]
If in doubt, Google: regex c++ - Google Search[^]
The top 4 links all cover what you need:
<regex> - C++ Reference[^]
C++11 regex tutorial | Solarian Programmer[^]
Regular expressions library - cppreference.com[^]
Regular Expressions (C++)[^]
帮助构建和调试RegEx的一些有趣的链接。
以下是RegEx文档的链接:
perlre - perldoc.perl.org [ ^ ]
以下是工具的链接帮助构建RegEx并调试它们:
。 NET Regex Tester - Regex Storm [ ^ ]
Expresso正则表达式工具 [ ^ ]
RegExr:Learn,Build,&测试RegEx [ ^ ]
此节目RegEx是一个很好的图表,它非常有助于理解RegEx的作用:
Debuggex:在线可视正则表达式测试器。 JavaScript,Python和PCRE。 [ ^ ]
Just a few interesting links to help building and debugging RegEx.
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[^]
RegExr: Learn, Build, & Test RegEx[^]
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.[^]
这篇关于正则表达式在C ++ visual studio 2010中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文