|
Among the conditions given by the landlord, some content needs to be clarified, that is, a and b, although a and b can be changed, they must meet certain conditions, for example, it appears in pairs or follows a certain format. You can use regular to match, can not be any string, otherwise you can not determine which is a and b you want, for example, a and b are as follows
<a> and </a>
<font> and </ font>
In this way, as well as the examples you give, you can use the following regular to extract the content you want
String yourStr = textBox1.Text;
Match m = Regex.Match (yourStr, "<(. *)> (. *?) </\\1>");
textBox2.Text = m.Groups [2] .Value; //m.Groups [2] .Value is the content to be extracted
This is just an example, you also need to specify the qualifications of a and b to give you the regularity you really need |
|