What are the basic grammatical characters of C #
This article mainly explains "what are the basic grammatical characters of C#". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "what are the basic grammar characters of C#"?
Basic grammatical characters of C # regular expressions
\ d the number of 0-9
The complement of\ D\ d (with all characters as the complete set, the same below), that is, all non-numeric characters
\ w word characters, which refer to uppercase and lowercase letters, 0-9 numbers, underscores
Complement of\ W\ w
\ s white space characters, including line feed\ n, carriage return\ r, tab\ t, vertical tab\ v, page feed\ f
Complement of\ S\ s
. Any character except the newline character\ n
[.] Match all the characters listed in []
[^...] Match characters not listed in []
Here are some examples of basic syntax characters for simple C# regular expressions:
String I = "\ n"; string m = "3"; Regex r = new Regex (@ "\ D"); / / same as Regex r = new Regex ("\\ D"); / / r.IsMatch (I) result: true / / r.IsMatch (m) result: false string i = "%"; string m = "3"; Regex r = new Regex ("[a-z0-9]") / / match lowercase letters or numeric characters / / r.IsMatch (I) result: false / / r.IsMatch (m) result: true so far, I believe you have a deeper understanding of "what are the basic grammatical characters of C#", you might as well do it in practice! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!