This is a wrapper of "
VBScript.RegExp" or an example of how to use "RegExp" in VC++. I have implemented some often used methods. You can add any more as you need.
VBScript.RegExp's performance is better than
VBScript.RegExp did not provide '
lastIndex' property, so I selected
VBScript.RegExp in VC++ and implemented '
lastIndex' by myself. I supply a convenient class
RegExp, and the style is like
When you use the regexp.h and regexp.cpp, do not forget to call
CoInitialize at the beginning of your program. Any suggestion is welcome. After you finish optimizing the code, please send a copy to me.
CoInitializeEx( NULL, COINIT_MULTITHREADED );
re.IgnoreCase( TRUE );
re.compile( _T("\w([\d.]*)(\w+)") );
re.exec( _T("I f3454ind it, f567.56ind it again") );
cout << re.index << _T(" ~ ") << re.lastIndex << endl;
cout << (LPCTSTR)re.SubMatch( 0 ) << endl;
cout << (LPCTSTR)re.SubMatch( 1 ) << endl << endl;