I have a text file that contains several words ........... ........... dimension="13.7mm" row="30" speed="13.4" ........ I want to extract the value 13.7mm This is what I have done //loaded the file string file = "c:\\temp\\myTextFile.txt"; string searchText = "dimension="; //Declare reader as a new StreamReader with file as the file to use StreamReader reader = StreamReader(file); //Declare text as the reader reading to the end String text = reader.ReadToEnd(); //If the searchText is a match if (Regex.IsMatch(text, searchText)) { MessageBox.Show("found it"); //OK now that I found the word 'dimension=" //how to display the next characters between the next " and " //the number of characters may vary (e.g. 125.7mm) }
sring[] lines = Regex.Split("server=", " "); foreach (string line in lines) { listBox1.Items.Add(line); }
capture
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)