Boost logo

Boost Users :

From: noamxnoam (noamxnoam_at_[hidden])
Date: 2003-06-15 02:29:59


Here's the code - thanks in advance for any help!

BOOL RegularExpressionMatch(const char *pstrRegEx, const char
*pstrExpression, BOOL bCaseSensitive)
{
        BOOL bRet;

        if(!pstrRegEx || !pstrExpression)
                return FALSE;

        try
        {
                int nCase = boost::regbase::normal;

                if(bCaseSensitive == FALSE)
                {
                        nCase |= boost::regbase::icase;
                }

                boost::regex expression(pstrRegEx,nCase);
                        
                if(boost::regex_match(pstrExpression, expression))
                {
                        bRet = TRUE;
                }
                else
                {
                        bRet = FALSE;
                }
        }
        catch(CSEHWrapper a)
        {
                if(pstrRegEx)
                {
                        printf("ERROR: RegularExpressionMatch(%s):
Exception %s ocurred", pstrRegEx, GetExceptionDesc(a.m_nSeCode));
                }
                else
                {
                        printf("ERROR: RegularExpressionMatch():
Exception %s ocurred", GetExceptionDesc(a.m_nSeCode));
                }

                bRet = FALSE;
        }
        catch(...)
        {
        }

        return bRet;
}

--- In Boost-Users_at_[hidden], "John Maddock"
<john_maddock_at_c...> wrote:
> > Tried to use the forward lookahead asserts, both positive and
> > negative and could not make a match. Is there some sample code
> > anywhere or a tip to explain where I went wrong?
>
> Please post an example of what you're trying to do.
>
> John.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net