...
首页> 外文期刊>MSDN Magazine >C++ At Work: Form Validation with Regular Expressions In MFC
【24h】

C++ At Work: Form Validation with Regular Expressions In MFC

机译:C ++工作:在MFC中使用正则表达式进行表单验证

获取原文
获取原文并翻译 | 示例
           

摘要

I thought I'd use this months column to describe an interesting app I built using the RegexWrap library described in my article "Wrappers: Use Our Man Wrap Library to Get the Best of .NET in Native C++ Code" in this issue. RegexForm is a form validation system for MFC based on regular expressions. This app was my main reason for implementing RegexWrap in the first place. But since many of the details don't relate to regex per se, it makes more sense to describe RegexForm here. As I mentioned in the article, one of the most practical applications of regular expressions is validating user input. Regular expressions make short shrift of validating ZIP codes, phone numbers, credit card numbers—all sorts of real-world information. One regular expression can replace dozens or even hundreds of lines of procedural code. UNIX and Web programming languages like Perl have had regular expressions since Day One, but until the .NET Framework, regular expressions weren't available in Windows* or MFC without a third-party library. So now that .NET provides a complete regular expressions library, why not use it in MFC apps? And with my RegexWrap library described in the main article, you don't even need the Managed Extensions or /clr.
机译:我以为我会在本期中使用本月专栏来描述我使用RegexWrap库构建的一个有趣的应用程序,该文章在我的文章“包装器:使用我们的Man Wrap库获得本机C ++代码中的最佳.NET”中进行了介绍。 RegexForm是基于正则表达式的MFC表单验证系统。这个应用程序是我首先实现RegexWrap的主要原因。但是由于许多细节与正则表达式本身无关,因此在这里描述RegexForm更为有意义。正如我在文章中提到的,正则表达式最实际的应用之一是验证用户输入。正则表达式使验证邮政编码,电话号码,信用卡号等各种现实世界信息的时间缩短了。一个正则表达式可以替换数十行甚至数百行程序代码。从第一天开始,UNIX和Web编程语言(如Perl)就具有正则表达式,但是直到.NET Framework出现,没有第三方库的Windows *或MFC中就无法使用正则表达式。因此,既然.NET提供了完整的正则表达式库,为什么不在MFC应用程序中使用它呢?有了主要文章中介绍的RegexWrap库,您甚至不需要托管扩展或/ clr。

著录项

相似文献

  • 外文文献
  • 中文文献
  • 专利
获取原文

客服邮箱:kefu@zhangqiaokeyan.com

京公网安备:11010802029741号 ICP备案号:京ICP备15016152号-6 六维联合信息科技 (北京) 有限公司©版权所有
  • 客服微信

  • 服务号