using System.Collections.Generic;
using System.Text.RegularExpressions;
public string Nota {get;set;}
public string Tag {get; set;}
public string SubTag {get; set;}
public DateTime Date {get;set;}
public Notes GetActionNotesTagEntryFromTag(string textWithTag, DateTime tagDateTime)
if (string.IsNullOrEmpty(textWithTag)) return null;
int subTagIdentifyer = textWithTag.IndexOf("#");
if (subTagIdentifyer > -1)
subTag = textWithTag.Substring(subTagIdentifyer + 1);
tag = textWithTag.Substring(0, subTagIdentifyer);
public static void Main(string[] args)
string text1 = "qweqw[qwe#w]qweqweqw";
DateTime date = new DateTime();
int tagStartChar = text1.IndexOf("[");
int tagEndChar = text1.IndexOf("]");
string tagForTest = text1.Substring(tagStartChar+1, (tagEndChar - tagStartChar -1));
Program t = new Program();
Notes getNoteInfo1 = t.GetActionNotesTagEntryFromTag(tagForTest, date);
Console.WriteLine("Note -> {0}\n Tag -> {1} \n SubTag -> {2}", getNoteInfo1.Nota, getNoteInfo1.Tag, getNoteInfo1.SubTag);