public Object _matchAll(INakoFuncCallInfo info) { string s = info.StackPopAsString(); string pattern = info.StackPopAsString(); m = Regex.Match(s, pattern); NakoVarArray res = info.CreateArray(); int index = 0; NakoVarArray groups = new NakoVarArray(); // NakoVariable ret = new NakoVariable(); while (m.Success) { res.SetValue(index, m.Value); NakoVarArray subgroups = new NakoVarArray(); for (int i = 0; i < m.Groups.Count; i++) { subgroups.SetValue(i, m.Groups[i].Value); } groups.Add(subgroups); // for(int i = 0;i < m.Groups.Count;i++){ // groups.SetValue(i,m.Groups[i].Value); // } // ret.Type = NakoVarType.Array; // ret.Body = groups; index++; m = m.NextMatch(); } info.SetVariableValue("抽出文字列", groups); return(res); }
public Object _sample_changeHoge(INakoFuncCallInfo info) { Object tmp = info.StackPop(); info.SetVariableValue("HOGE", tmp); return(null); }
// Define Method public Object _match(INakoFuncCallInfo info) { string s = info.StackPopAsString(); string pattern = info.StackPopAsString(); m = Regex.Match(s, pattern); NakoVarArray groups = info.CreateArray(); if (m.Success) { for (int i = 0; i < m.Groups.Count; i++) { groups.SetValue(i, m.Groups[i].Value); } info.SetVariableValue("抽出文字列", groups); return(m.Value); } return(""); }
public Object _sample_changeHoge(INakoFuncCallInfo info) { Object tmp = info.StackPop(); info.SetVariableValue("HOGE", tmp); return null; }
// Define Method public Object _match(INakoFuncCallInfo info) { string s = info.StackPopAsString(); string pattern = info.StackPopAsString(); m = Regex.Match(s,pattern); NakoVarArray groups = info.CreateArray(); if(m.Success){ for(int i = 0;i < m.Groups.Count;i++){ groups.SetValue(i,m.Groups[i].Value); } info.SetVariableValue("抽出文字列", groups); return m.Value; } return null; }
public Object _matchAll(INakoFuncCallInfo info) { string s = info.StackPopAsString(); string pattern = info.StackPopAsString(); m = Regex.Match(s,pattern); NakoVarArray res = info.CreateArray(); int index = 0; NakoVarArray groups = new NakoVarArray(); // NakoVariable ret = new NakoVariable(); while(m.Success){ res.SetValue(index,m.Value); NakoVarArray subgroups = new NakoVarArray(); for (int i = 0; i < m.Groups.Count; i++) { subgroups.SetValue(i,m.Groups[i].Value); } groups.Add(subgroups); // for(int i = 0;i < m.Groups.Count;i++){ // groups.SetValue(i,m.Groups[i].Value); // } // ret.Type = NakoVarType.Array; // ret.Body = groups; index++; m = m.NextMatch(); } info.SetVariableValue("抽出文字列", groups); return res; }