Micsoft's. NET already supports regular expressions, and you can use the frame class regex. If you use regular expressions to replace strings that match rules, there are some small differences in the use of visual c++.net and Visual C #. Net.
1. Visual c++.net
Use of namespaces: using namespace system::text::regularexpressions;
String *s = "Test text sample for regular expression";
(1) Define object: Regex *rx = new Regex ("t[^]*");//Match string starting with T, followed by 0 to n non-whitespace characters until a space end is encountered
Complete Match replacement: s = rx->replace (S, "");//Match to later, delete
(2) can also be used directly with the static function of replace to complete the above operation:
s = Regex::replace (S, "t[^]*", "");
2. Visual c#.net
Use of namespaces: using System.Text.RegularExpressions;
String s = "Test text sample for regular expression";
(1) Define object: Regex rx = new Regex ("t[^]*");//Match string starting with T, followed by 0 to n non-whitespace characters until a space end is encountered
Complete Match replacement: s = Rx. Replace (S, "");//Match to later, delete
(2) using static function Regex::replace to complete
s = Regex.Replace (S, "t[^]*", "");
Explanation: The difference between the two is mainly the difference of grammatical rules.