Search data from a txt

Hi guys I have a query: I have a .txt file which I created a loop to read each line to find a data example “5x8” the problem is that the data is not always in the same position or line for it when I try search by means of blank spaces in the source txt works but in another no longer because I change the amount of blank spaces.

How can I do so that regardless of how many spaces the line has if the “5x8” data always brings me that data since it can be started, in the middle or at the end of the line?

Thanks for your help

Use Regular Expression and “Split” (Or whatever you need to do) at the position of Match.
Or try this: item.IndexOf(“5x8”) to get Position Number inside string

1 Like

Hello @asesor-rpa

Thank you for your prompt response I was looking and I did it this way
item.Substring (item.IndexOf (“5x8”) + “” .Length) .Split (Environment.NewLine.ToCharArray) (0)
It works for me since it takes the character that I always need as the first character in the line after I did this
item.Split ("". ToCharArray) (0)
and with this I already have the value you need