Boost-users][regex] Can I use NULL char (ascii \x00) as a part of boost_regex regular expression

I want to use NULL char i.e ascii \x00 as a part of my regular expression. Does boost_regex support this? For examples: regular expression: ab\0cd matching char sequence: ab\0cd I expect ot get match a match for full expression ab\0cd How can I achieve this using boost_regex. Regards, Chandan. ____________________________________________________________________________________ Luggage? GPS? Comic books? Check out fitting gifts for grads at Yahoo! Search http://search.yahoo.com/search?fr=oni_on_mail&p=graduation+gifts&cs=bz

Chandan Nilange wrote:
I want to use NULL char i.e ascii \x00 as a part of my regular expression. Does boost_regex support this?
For examples:
regular expression: ab\0cd matching char sequence: ab\0cd I expect ot get match a match for full expression ab\0cd
How can I achieve this using boost_regex.
Sure, for example any of the following constructors can accept an embedded NULL: basic_regex(const charT* p1, const charT* p2, flag_type f = regex_constants::normal); basic_regex(const charT* p, size_type len, flag_type f); template <class ST, class SA> explicit basic_regex(const basic_string<charT, ST, SA>& p, flag_type f = regex_constants::normal); template <class InputIterator> basic_regex(InputIterator first, InputIterator last, flag_type f = regex_constants::normal); HTH, John.

Hi, I'm trying to bind Win32 API function RegCloseKey like this (I'm using VC 2005 Express): HKEY hKey; //--initialize hKey boost::function<LONG(void)> RegClose = boost::bind(&RegCloseKey, hKey); And I got the following error : 1>e:\kamil\library\boost\bind.hpp(66) : error C2825: 'F': must be a class or namespace when followed by '::' 1> e:\kamil\library\boost\bind\bind_template.hpp(15) : see reference to class template instantiation 'boost::_bi::result_traits<R,F>' being compiled 1> with 1> [ 1> R=boost::_bi::unspecified, 1> F=long (__stdcall *)(HKEY) 1> ] 1> e:\kamil\personal\function\function.cpp(10) : see reference to class template instantiation 'boost::_bi::bind_t<R,F,L>' being compiled 1> with 1> [ 1> R=boost::_bi::unspecified, 1> F=LONG (__stdcall *)(HKEY), 1> L=boost::_bi::list1<boost::_bi::value<HKEY >> 1> ] 1>e:\kamil\library\boost\bind.hpp(66) : error C2039: 'result_type' : is not a member of '`global namespace'' 1>e:\kamil\library\boost\bind.hpp(66) : error C2146: syntax error : missing ';' before identifier 'type' 1>e:\kamil\library\boost\bind.hpp(66) : error C2208: 'boost::_bi::type' : no members defined using this type 1>e:\kamil\library\boost\bind.hpp(66) : fatal error C1903: unable to recover from previous error(s); stopping compilation Any idea how to fix this ? ____________________________________________________________________________________ Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. http://smallbusiness.yahoo.com/webhosting

On 8/31/07, Kamil Zubair <kamilzubair@yahoo.com> wrote:
Hi, I'm trying to bind Win32 API function RegCloseKey like this (I'm using VC 2005 Express):
HKEY hKey; //--initialize hKey boost::function<LONG(void)> RegClose = boost::bind(&RegCloseKey, hKey);
It seems that Boost.Bind can't handle __stdcall functions. Fortunately Boost.Function can. Try this as a workaround: HKEY key; function<LONG ()> f = bind(function<LONG (HKEY)>(RegCloseKey), key); Cheers. -- Slavomir Kaslev

Kamil Zubair:
Hi, I'm trying to bind Win32 API function RegCloseKey like this (I'm using VC 2005 Express):
HKEY hKey; //--initialize hKey boost::function<LONG(void)> RegClose = boost::bind(&RegCloseKey, hKey);
You can either #define BOOST_BIND_ENABLE_STDCALL or use boost::bind<LONG>. See http://boost.org/libs/bind/bind.html#Q_win32_api
participants (5)
-
Chandan Nilange
-
John Maddock
-
Kamil Zubair
-
Peter Dimov
-
Slavomir Kaslev