Replace a paragraph in the <title> tags with c# | Sololearn: Learn to code for FREE!
¡Nuevo curso! ¡Todo programador debería aprender IA Generativa!
Prueba una lección gratuita
0

Replace a paragraph in the <title> tags with c#

I am creating a function that can replace a paragraph in the tags and delete the scripts with tags, can you see the syntax I have written correctly? ----------------------------------------------------------------------------------------------- StreamReader tx = new StreamReader("page2.txt"); string title = Regex.Match("page2.txt", @"\<title\b[^>]*\>\s*(?<Title>[\s\S]*?)\</title\>", RegexOptions.IgnoreCase).Groups["Title"].Value; List<string> lines = new List<string>(); while (!tx.EndOfStream) lines.Add(tx.ReadLine()); string linetoreplace = lines[0]; string contents = tx.ReadToEnd(); StreamWriter sw = new StreamWriter(" how to ? thay the"); } public static void DelJs() { StreamReader tx = new StreamReader("page2.txt"); Regex rRemScript = new Regex(@"<script[^>]*>[\s\S]*?</script>"); newtx = rRemScript.Replace(oldtx, ""); return newtx; }

17th Oct 2017, 4:03 PM
Olioty
Olioty - avatar
5 Respuestas
0
someone ?
17th Oct 2017, 4:31 PM
Olioty
Olioty - avatar
0
...
17th Oct 2017, 4:55 PM
Olioty
Olioty - avatar
0
???
17th Oct 2017, 10:26 PM
Olioty
Olioty - avatar
0
????
18th Oct 2017, 6:42 AM
Olioty
Olioty - avatar
0
nobody else ?
18th Oct 2017, 2:22 PM
Olioty
Olioty - avatar