Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Text.RegularExpressions;
- namespace FilterOut
- {
- class Program
- {
- static void Main(string[] args)
- {
- Validate("valid_strig_123");
- Validate("I think not!");
- }
- static void Validate(string s)
- {
- var re = new Regex(@"[^a-z0-9_]", RegexOptions.IgnoreCase);
- if (re.IsMatch(s))
- Console.WriteLine("Nope");
- else
- Console.WriteLine("OK");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement