static public Varibale FindVaribale(int index, string name, string text) { if (index < text.Length) { Regex regexToFindVaribale = new Regex(@"(?<=[\+,\-,\*,\/,\(,\),\,,\s]+)" + name + @"(?=[\+,\-,\*,\/,\(,\),\.\;,\,,\s]*)"); Match findVaribaleMatch = regexToFindVaribale.Match(text, index); if (findVaribaleMatch.Success) { //if((index = text.IndexOf(name, index)) != -1) //{ Varibale varibale = new Varibale(name, findVaribaleMatch.Index); return(varibale); } else { return(null); } } else { return(null); } }
public static Varibale FindVaribale(int index, string name, string text) { if (index < text.Length) { Regex regexToFindVaribale = new Regex(@"(?<=[\+,\-,\*,\/,\(,\),\,,\s]+)"+name+@"(?=[\+,\-,\*,\/,\(,\),\.\;,\,,\s]*)"); Match findVaribaleMatch = regexToFindVaribale.Match(text, index); if (findVaribaleMatch.Success) { //if((index = text.IndexOf(name, index)) != -1) //{ Varibale varibale = new Varibale(name, findVaribaleMatch.Index); return varibale; } else { return null; } } else { return null; } }