---restore content starts---
Baidu on the Internet a lot about regular expression, but a lot of it is about the grammar, there is no specific case, a bit difficult to get started, after all, I still like from concrete to abstract understanding. So I'm here to provide a small case of entry (learned about 6 months of Java, now transformation C #, may be some details can not, please advise)
usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Text.RegularExpressions;usingSystem.Threading.Tasks;usingMicrosoft.SqlServer.Server;namespaceconsoleapplication6{classProgram {Static voidMain (string[] args) { Const stringMyText =@"thiscomprehensive Compendium provides a broad and thorough investigation of all aspects of programming with ASP. Entirely revised and updaeted for the fourth release of. Net,this book'll give you the information to master ASP. NET and build Adynamic,successful,enterprise Web application."; stringPattern =@"\bn"; MatchCollection mymathches= Regex.Matches (MyText, pattern, regexoptions.ignorecase |regexoptions.explicitcapture); foreach(Match NextMatchinchmymathches) {Console.WriteLine (Nextmatch.index); } } }}
Note the symbol at the front of the string @ (function here: indicates where the escape character is "not" handled). Pass the \b to when you want to run it again. NET regular expression engine, a backslash (\) should not be interpreted as an escape sequence by the C # compiler. If you want to find the word that ends with the sequence ion, you can apply the following code:
const string [email protected] "ion\b";
Now that we have a general idea of how to use regular expressions after running the process sequence, the syntax of the regular expression is saved:
Just provide a connection, because there are really a lot of grammar introduction, the official website also has OH.
http://www.imooc.com/article/8419
I believe that after reading these grammars, we should see this again.
Well, that's the end of it. Hope to help you get a quick start
Regular expression Getting started Case C #