2
I am trying to get two specific values on each line of a txt file. As an example:
15/06/2016  R$ 638,69   R$ 2.562,46
15/07/2016  R$ 672,43   R$ 2.533,51
15/08/2016  R$ 658,93   R$ 2.504,75
15/09/2016  R$ 1.362,28   R$ 2.471,80
15/10/2016  R$ 1.342,20   R$ 2.435,41
15/11/2016  R$ 1.321,80   R$ 2.398,40
I need to get from each line the two values ex: "R$ 638,69" and "R$ 2,562,46", but as the values can change from cents to millions. There is no way I can read the string by position! I tried to mount a regexbut without success. Someone with a better idea?
    if (FileUpload1.HasFile)
                {
                    using (StreamReader texto = new StreamReader(FileUpload1.FileContent))
                    {
                        while ((mensagem = texto.ReadLine()) != null)
                        {
                            mensagemLinha.Add(mensagem);
                        }
                    }
    for (int i = 0; i < mensagemLinha.Count; i++)
                    {
                        string re1 = "()";  
                        string re2 = ".*?"; 
                        string re3 = "(\\$)";  
                        string re4 = "( )"; 
                        string re5 = ".*?"; 
                        string re6 = "(,)"; 
                        string re7 = ".*?"; 
                        string re8 = "(R)"; 
                        string re9 = "(\\$)";  
                        string re10 = "( )";    
                        string re11 = ".*?";    
                        string re12 = "(\\.)"; 
                        string re13 = ".*?";   
                        string re14 = "(,)";
                        Regex rex = new Regex(re1 + re2 + re3 + re4 + re5 + 
                        re6 + re7 + re8 + re9 + re10 + re11 + re12 + 
                        re13 + re14, RegexOptions.IgnoreCase | RegexOptions.Singleline);
                        Match valores = rex.Match((mensagemLinha[i].ToString()));
                        lblArq.Text += valores ;
    }  
If the information is this take the given by the position he is in.
– Maniero
@Maniero the positions are not fixed, depending on the decimal places the blocking position is changed. Note that the position of the values of lines 4,5,6 were shifted.
– Evandro