using System;
using System.Text.RegularExpressions;
public class Example
{
public static void Main()
{
string pattern = @".*Aussen.*?<\/code>.*?([^<]*)";
string input = @"<html> <head><title>Modbus Mapping - Guntamatic</title>
<meta charset=""iso-8859-1""><style>table { border-collapse:collapse; text-align: center; }table, td, th { border:1px solid black; padding: 2px; }th {vertical-align: top; }
</style></head><body><h1>Modbus Mapping</h1>
<table>
<thead> <tr><th>Id</th><th>Register</th><th>Adresse</th><th>Typ</th><th>Einheit</th><th>Größe<br>(Byte)</th><th>Name</th><th>aktueller Wert</th></tr> </thead> <tbody> <tbody> <tr><td>0</td><td>0x4001</td><td>0x4000</td><td>string</td><td> </td><td>4</td><td>Betrieb</td><td><code>0x41555300</code>AUS</tr> <tr><td>1</td><td>0x4003</td><td>0x4002</td><td>float</td><td>°C</td><td>4</td><td>Aussentemperatur</td><td><code>0x40f1d8e2</code>7.56</td></tr> <tr><td>3</td><td>0x4007</td><td>0x4006</td><td>float</td><td>°C</td><td>4</td><td>Kesseltemperatur</td><td><code>0x4253c0e5</code>52.94</td></tr> </tbody></table> <h2>Erweiterte Texte</h2><table> <thead> <tr><th>Id</th><th>Register</th><th>Adresse</th><th>Größe<br>(Byte)</th><th>Name</th><th>aktueller Wert</th></tr> </thead> </tbody></table></body></html>";
RegexOptions options = RegexOptions.Multiline | RegexOptions.Singleline;
foreach (Match m in Regex.Matches(input, pattern, options))
{
Console.WriteLine("'{0}' found at index {1}.", m.Value, m.Index);
}
}
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx