- Home /
Get all strings between two key words ?
Hello, it's my first question on this site I'm french my code IEnumerator AllMusic() { WWW www = new WWW("https://www.examplesite.com); yield return www; string str = ""; str = Scrap(www.text, "<li>", "</li>"); File.WriteAllText(@"out.txt", str); // For debug } string Extract(string data, string startString, string endString) { try { // Start pos int pos1 pos1 = data.IndexOf(startString); pos1 += startString.Length; // End pos int pos2; pos2 = data.IndexOf(endString, pos1); return data.Substring(pos1, pos2 - pos1); } catch (Exception e) { Debug.LogError("Erreur lors du scrapping : " + e); return "impossible"; } }
With my code, I can extract just the first string between <li>
and </li>
, but the others aren't extracted... How to do that ? I searched : 1. Extraire plusieurs strings entre deux caractère c# 2. Extract multiple strings between two delimiters c# 3. Get all strings between two delimiters c# And other, but i can't find anything on that
I'm really sorry for my bad English, i'm french and i'm 15