sheffield

Simple Id Validation C#

Aug 6th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.35 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3.  
  4. public class SimpleIdValidation
  5. {
  6.     public static bool Validate(string id)
  7.     {
  8.     //---XXXXX--- with X alphanumeric and at least length of 1/at most of 5
  9.      Regex regex = new Regex(@"(\-){3}([A-Za-z0-9]){1,5}(\-){3}");
  10.      Match match = regex.Match(id);
  11.      return (match.Success);
  12.     }
  13. }
Add Comment
Please, Sign In to add comment