Letters:
Digital
Single digit \d
Non-digital \d
Character Boundary \b
Any character.
Character dot \.
or [ABC]: Match A or B or C can match
Repeat multiple c{2} matches two C
Repeat multiple (range) b{2,3} match repeat 2 to 3 times B
Repeat multiple times (0-Multiple) b* match 0 to multiple B
Repeat multiple (1-Multiple) B + matches 1 to multiple B
Match a single B? Match either have B or no B
Match Blank \s (small s)
Match all the places that are not blank \s (big S)
Opening ^
End $
Any length *
Comprehensive testing:
^abb.*b34$ matches all of the examples
Explanation with the beginning of ABB, any character any length matches, finally with b34 end
Match a paragraph (ABBC)
Match all (. *)
All characters \w (lowercase) one match (not including symbols)
In addition to all characters that are symbols \w (uppercase) one match
string[] values = {"111-22-3333","212-64-4321","12133213232132" }; stringPattern =@"^\d{3}-\d{2}-\d{4}"; foreach(stringAinchvalues) { if(Regex.IsMatch (A, pattern)) {Console.WriteLine ("{0} is valid", a); } Else{Console.WriteLine ("{0} is not valid", a); }} console.readline ();
C # Regular Expressions