1 #include <boost/cregex.hpp>
10 #include <luabind/luabind.hpp>
13 void wrap_regex(lua_State
* L
)
16 using namespace luabind
;
18 class_
<RegEx
>(L
, "regex")
19 .def(constructor
<const char*>())
20 .def(constructor
<const char*, bool>())
21 .def("match", (bool(RegEx::*)(const char*, unsigned int))&RegEx::Match
)
22 .def("search", (bool(RegEx::*)(const char*, unsigned int))&RegEx::Search
)
23 .def("what", &RegEx::What
)
24 .def("matched", &RegEx::Matched
)
25 .def("length", &RegEx::Length
)
26 .def("position", &RegEx::Position
)
29 value("match_default", boost::match_default
),
30 value("match_prev_avail", boost::match_prev_avail
),
31 value("match_not_bob", boost::match_not_bob
)
36 void test_wrap_regex()
38 lua_State
* L
= lua_open();
44 lua_dofile(L
, "regex.lua");