public ViewModel() { RegexHandler = new RegexHandlerModel(); RegexListBoxCollection = new ObservableCollection <string>(); //for demo RegexCollection.Add(@"<(?<user>\w+)>(?<text>.+)"); RegexCollection.Add(@"(?<IP>^((\d{1,3}\.){3}\d{1,3})).*"); }
/// <summary> /// <para>calls to InitData</para> /// </summary> private void GoExecute() { // if the user has searched with a new expression, add it to the list. if (!RegexCollection.Contains(RegularExpressionString)) { RegexCollection.Add(RegularExpressionString); } InitData(); }
public static IEnumerable <string[]> SmartRegex( this IEnumerable <string> collection, Func <RegexCollection, Regex> selector ) { var regexCollection = new RegexCollection(); return(collection.Select(l => selector(regexCollection).Split(l))); }