Hi,
i want to use regular expression in my project for validation of
email. How i can use Regular Expression in VC?? i am using vs2k5 IDE.
i seen boost api for regular expression, is it any regular expression
functionality available in VC ???? if yes, how i can use them???
regards,
-aims
.
adebaene@club-internet.fr - 03 Apr 2007 13:56 GMT
> Hi,
>
> i want to use regular expression in my project for validation of
> email. How i can use Regular Expression in VC?? i am using vs2k5 IDE.
> i seen boost api for regular expression, is it any regular expression
> functionality available in VC ???? if yes, how i can use them???
If you're doing managed programming (ie, using C++/CLI and the .NET
framework), there is regular expression support in the framework.
If you're doing native coding, there is a regex engine in ATL server :
see http://msdn2.microsoft.com/en-us/library/wzck77h4(VS.80).aspx
Anyway, I would rather recommend to use boost...
Arnaud
MVP - VC
Nathan Mates - 03 Apr 2007 17:56 GMT
>i want to use regular expression in my project for validation of
>email. How i can use Regular Expression in VC?? i am using vs2k5 IDE.
>i seen boost api for regular expression, is it any regular expression
>functionality available in VC ???? if yes, how i can use them???
Try http://www.pcre.org/ -- Perl Compatible Regular
Expressions. It's available with full source code, and has a BSD
license (making it quite easy to distribute with any of your apps).
It's been used in a lot of well-known software projects. It'd probably
be easier to integrate than boost.
Nathan Mates
--
<*> Nathan Mates - personal webpage http://www.visi.com/~nathan/
# Programmer at Pandemic Studios -- http://www.pandemicstudios.com/
# NOT speaking for Pandemic Studios. "Care not what the neighbors
# think. What are the facts, and to how many decimal places?" -R.A. Heinlein
Mohammad Omer - 04 Apr 2007 11:32 GMT
Cholo Lennon - 04 Apr 2007 16:48 GMT
Also you can use GRETA
http://research.microsoft.com/projects/greta/
Regards
--
Cholo Lennon
Bs.As.
ARG
> Hi,
>
[quoted text clipped - 7 lines]
>
> .
Mohammad Omer - 06 Apr 2007 06:30 GMT
> Also you can use GRETA
>
> http://research.microsoft.com/projects/greta/
This is cool! Thanks Cholo Lennon!
Regards,
-aims
Mohammad Omer - 06 Apr 2007 07:04 GMT
Hi Cholo Lennon!
i found these line of code for using regular expression in VC, please
guide me, Is this right to use it or use some other API for the
regular expression??
Code is:
#include <atlrx.h>
CAtlRegExp<> re;
re.Parse(TEXT("\\w+([-+.']\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*"));
CAtlREMatchContext<> mc;
if(!re.Match(singleEmail, &mc))
{
retStatus = FALSE;
break;
}
Regards,
-aims
Cholo Lennon - 06 Apr 2007 16:30 GMT
Those lines use ATL server library (check Arnaud response). In general all regex libraries use the same concepts so it's easy to
port those code to other libraries.
ATL server is part of VC 7 (or above) so it's fine to use it. If you want portability to other plattforms you can use boost
libraries (http://www.boost.org/libs/regex/doc/index.html) or like Nathan Mates said, Perl Compatible Regular Expressions.
Regards
--
Cholo Lennon
Bs.As.
ARG
> Hi Cholo Lennon!
>
[quoted text clipped - 17 lines]
> Regards,
> -aims
Mohammad Omer - 09 Apr 2007 06:07 GMT
Thanks Cholo Lennon.
Regards,
-aims