Prev: Problem handling keyboard events in ActiveX on IE8
Next: project dependencies: satellite dlls and main-project
From: Cameron_C on 22 Jun 2010 11:56 Hello again folks, I am working through things in my application, and I would appreciate any recommended approaches to using Regular Expressions in my code. This is an MFC application. I am using Visual Studio 2008 pro. I have read about references to a "boost" library, and I have read references to an ATL regex class, and I have read something about Regular Expressions being included in SP1 of VS2008. I wnat to use regular expressions to edit telephone numbers, and Postal Codes, and dollar amount fields. Anyway, if anyone has any experience with any of the above, and can offer some advice or recommendation, I would appreciate it.
From: Joseph M. Newcomer on 22 Jun 2010 12:16 Regular expressions are most powerful when you are doing either searches for a match or a set of edits that are characterized by a simple "programmattic" replacement of many, many instances. While I can certainly see how a regexp might help find things in a directory of people and telephone numbers, I'm not at all sure how it would help in editing-by-way-of-regexp. joe On Tue, 22 Jun 2010 08:56:12 -0700, Cameron_C <CameronC(a)discussions.microsoft.com> wrote: >Hello again folks, >I am working through things in my application, and I would appreciate any >recommended approaches to using Regular Expressions in my code. >This is an MFC application. I am using Visual Studio 2008 pro. >I have read about references to a "boost" library, and I have read >references to an ATL regex class, and I have read something about Regular >Expressions being included in SP1 of VS2008. >I wnat to use regular expressions to edit telephone numbers, and Postal >Codes, and dollar amount fields. > >Anyway, if anyone has any experience with any of the above, and can offer >some advice or recommendation, I would appreciate it. Joseph M. Newcomer [MVP] email: newcomer(a)flounder.com Web: http://www.flounder.com MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Giovanni Dicanio on 22 Jun 2010 12:27 On 22/06/2010 17:56, Cameron_C wrote: > I have read about references to a "boost" library, and I have read > references to an ATL regex class, and I have read something about Regular > Expressions being included in SP1 of VS2008. The ATL regular expression class is CAtlRegEx, and it was available in VC8 (i.e. VS2005), too: http://msdn.microsoft.com/en-us/library/k3zs4axe(VS.80).aspx I don't know about boost's regex, but it is correct that with the C++ Feature Pack (and then SP1) for VS2008 a regular expression template well integrated with STL was offered (this is available in VS2010 as well): http://msdn.microsoft.com/en-us/library/bb982727.aspx http://msdn.microsoft.com/en-us/library/bb982382.aspx If you plan to write portable C++ code you may want to consider the TR1's regex engine. If you don't like STL style and are not interested in multiplatform C++ code, you may consider the CAtlRegEx class instead. Note that TR1's regex engine uses C++ exceptions (e.g. regex_error class is thrown in some cases), instead ATL's CAtlRegEx tends to use error return codes (like BOOLeans). So if your programming style tends to prefer error codes instead of exceptions you may want to choose CAtlRegEx. HTH, Giovanni
From: Pete Delgado on 22 Jun 2010 12:26 "Cameron_C" <CameronC(a)discussions.microsoft.com> wrote in message news:54293FD0-0333-40D0-92D8-E2B62A03C822(a)microsoft.com... > Hello again folks, > I am working through things in my application, and I would appreciate any > recommended approaches to using Regular Expressions in my code. > This is an MFC application. I am using Visual Studio 2008 pro. > I have read about references to a "boost" library, and I have read > references to an ATL regex class, and I have read something about Regular > Expressions being included in SP1 of VS2008. > I wnat to use regular expressions to edit telephone numbers, and Postal > Codes, and dollar amount fields. > > Anyway, if anyone has any experience with any of the above, and can offer > some advice or recommendation, I would appreciate it. > Any of the above approaches that you have mentioned will work, however as with any engineering decision, there are tradeoffs. I would recommend against using the ATL regular expression library because it uses a non-standard syntax and is fairly limited in its abilities.If you can handle the limitations of the library and are willing to work with the peculiar regular expression syntax for the library, it will probably work as well. I personally prefer to use the std::tr1 regular expression library, but I have used the boost regular expression library as well. A quick look on the net shows more examples of usage for the boost libraries than for the tr1 libraries so this may be a determening factor for you! -Pete TR1 http://www.johndcook.com/cpp_regex.html http://msdn.microsoft.com/en-us/library/bb982727.aspx Boost http://www.boost.org/doc/libs/1_43_0/libs/regex/doc/html/index.html http://onlamp.com/pub/a/onlamp/2006/04/06/boostregex.html
From: Pete Delgado on 22 Jun 2010 12:43 "Giovanni Dicanio" <giovanniDOTdicanio(a)REMOVEMEgmail.com> wrote in message news:%23IDkFfiELHA.5736(a)TK2MSFTNGP02.phx.gbl... > On 22/06/2010 17:56, Cameron_C wrote: > >> I have read about references to a "boost" library, and I have read >> references to an ATL regex class, and I have read something about Regular >> Expressions being included in SP1 of VS2008. > > The ATL regular expression class is CAtlRegEx, and it was available in VC8 > (i.e. VS2005), too: > > http://msdn.microsoft.com/en-us/library/k3zs4axe(VS.80).aspx > > I don't know about boost's regex, but it is correct that with the C++ > Feature Pack (and then SP1) for VS2008 a regular expression template well > integrated with STL was offered (this is available in VS2010 as well): > > http://msdn.microsoft.com/en-us/library/bb982727.aspx > http://msdn.microsoft.com/en-us/library/bb982382.aspx > > > If you plan to write portable C++ code you may want to consider the TR1's > regex engine. If you don't like STL style and are not interested in > multiplatform C++ code, you may consider the CAtlRegEx class instead. The boost library implementation is as portable as the stl version... > > Note that TR1's regex engine uses C++ exceptions (e.g. regex_error class > is thrown in some cases), instead ATL's CAtlRegEx tends to use error > return codes (like BOOLeans). So if your programming style tends to prefer > error codes instead of exceptions you may want to choose CAtlRegEx. CAtlRegEx uses a limited, non-standard syntax while both boost and the TR1 regular expression libraries support a variety of standard regular expression syntaxes. Personally, I don't think I will ever use the ATL regular expression library again because of its limitations. -Pete
|
Next
|
Last
Pages: 1 2 3 4 Prev: Problem handling keyboard events in ActiveX on IE8 Next: project dependencies: satellite dlls and main-project |