Regular expressions for Lua
#3
I was just thinking about something simple like this:
static int tolua_RegexMatch(lua_State * tolua_S)
{
	cLuaState S(tolua_S)
	if (
		!S.CheckParamString(1, 2)
	)
	{
		return 0;
	}
	
	AString str, regexstring, res;
	L.GetStackValues(1, str, regexstring);
	
	std::regex reg(regexstring);
	res = std::regex_match(str, reg);
	
	L.Push(res);
}

///
//...
///

tolua_beginmodule(tolua_S, "cRegex");
	tolua_function(tolua_S, "Match", tolua_RegexMatch);
tolua_endmodule(tolua_S);

Reply
Thanks given by: jan64


Messages In This Thread
Regular expressions for Lua - by NiLSPACE - 10-13-2015, 11:14 PM
RE: Regular expressions for Lua - by xoft - 10-14-2015, 07:20 AM
RE: Regular expressions for Lua - by NiLSPACE - 10-14-2015, 04:45 PM



Users browsing this thread: 2 Guest(s)