using System.Text.RegularExpressions;
public static void Main()
string texto = "<p align=\"JUSTIFY\" style=\"margin-bottom:0cm;\"><strong>Hace más de" +
"doscientos años, en la mayor parte del territorio de América del" +
"Norte habitaban los sioux en campamentos de tiendas, igual que otros" +
"indios de las praderas. Vivían pacíficamente y su principal riqueza" +
"eran los bisontes, de los que obtenían carne para alimentarse," +
"pieles para abrigarse y huesos con los que fabricaban utensilios de" +
"uso cotidiano.</strong></p>";
Console.WriteLine(textIndexation(texto));
public static string textIndexation(string source)
bool endhtmlflag = false;
bool endwordflag = false;
Regex alphanumericregexp = new Regex(@"[a-zA-Z0-9áéíóúñ]");
Regex endwordregexp = new Regex (@"[\s.:,;]");
char[] text = source.ToCharArray();
while (pos < text.Length)
if (text[pos].ToString().CompareTo("<") == 0)
Console.WriteLine("start html -> pos=" + pos + " - text(pos)=" + text[pos]);
if (text[pos].ToString().CompareTo(">") == 0)
else if (text[pos].ToString().CompareTo(" ") == 0)
Console.WriteLine("blankspace -> pos=" + pos );
else if (text[pos].ToString().CompareTo("\\") == 0)
Console.WriteLine("breaklline -> pos=" + pos + " - text(pos)=" + text[pos]);
result += "\\" + text[pos];
else if (alphanumericregexp.IsMatch(text[pos].ToString()))
Console.WriteLine("start alphanumeric -> pos=" + pos + " - text(pos)=" + text[pos]);
aux = "<span data-windex='" + windex++ + "'>";
if (!alphanumericregexp.IsMatch(text[pos].ToString()))
else if(endwordregexp.IsMatch(text[pos].ToString()))
Console.WriteLine("else NOT CAPTURED -> pos=" + pos + " - text(pos)=[ " + text[pos] + " ]");