Skip Navigation Links.

Northwind\General\RegExsBase.cs

D:\NorthwindForWeb\Northwind\CS\DotNet\ADO.Net\Northwind\General\RegExsBase.cs
/*
 * This file was generated by ProCG version 2.0
 *
 * File name:	Northwind\General\RegExsBase.cs
 * Language:	C# - ADO.Net 
 * Database:	My Sql
 *
 * Copyright (c) 2002-2019 iGenXSoft.
 * For more information visit http://www.igenxsoft.com
 */


using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;

namespace Northwind.General
{
	public class RegExsBase
	{

		///  ^\d{1,3}$
		///      Beginning of line or string
		///      Any digit, between 1 and 3 repetitions
		///      End of line or string
		///  
		///
		/// </summary>
		enum RegularExpressionEnum
		{
			UserName,
			Password,
			Email,
			Url
		}

		public static string GetIntegerPattern(int minDigits, int maxDigit)
		{
			string integerPattern = "^({null}|-?\\d{" + minDigits + "," + maxDigit + "})$";
			return integerPattern;
		}

		static public bool ValidInteger(string integerText, int minDigits, int maxDigits)
		{
			Regex integerRegex = new Regex(GetIntegerPattern(minDigits, maxDigits));

			bool IsMatch = integerRegex.IsMatch(integerText);
			return IsMatch;
		}

		// decimal pattern ^\d{1,3}\.?\d{0,2}$

		public static string GetDecimalPattern(int leftDigits, int rightDigits)
		{
			string decimalPattern = "^({null}|-?\\d{1," + leftDigits + "}\\.?\\d{0," + rightDigits + "})$";
			return decimalPattern;
		}

		static public bool ValidDecimal(string decimalText, int leftDigits, int rightDigits)
		{
			Regex decimalRegex = new Regex(GetDecimalPattern(leftDigits, rightDigits));

			bool IsMatch = decimalRegex.IsMatch(decimalText);
			return IsMatch;
		}


		/// <summary>
		///  Regular expression built for C# on: ����, ��� 2, 2009, 03:27:10 PM
		///  Using Expresso Version: 3.0.3276, http://www.ultrapico.com
		///  
		///  A description of the regular expression:
		///  
		///  Beginning of line or string
		///  Match expression but don't capture it. [http|https|ftp]
		///      Select from 3 alternatives
		///          http
		///              http
		///          https
		///              https
		///          ftp
		///              ftp
		///  ://
		///      ://
		///  Any character in this class: [a-zA-Z0-9\.\-], one or more repetitions
		///  Match expression but don't capture it. [\:\d{1,5}], zero or one repetitions
		///      \:\d{1,5}
		///          Literal :
		///          Any digit, between 1 and 5 repetitions
		///  Match expression but don't capture it. [[A-Za-z0-9\.\;\:\@\&\=\+\$\,\?/]|%u[0-9A-Fa-f]{4}|%[0-9A-Fa-f]{2}], any number of repetitions
		///      Select from 3 alternatives
		///          Any character in this class: [A-Za-z0-9\.\;\:\@\&\=\+\$\,\?/]
		///          %u[0-9A-Fa-f]{4}
		///              %u
		///              Any character in this class: [0-9A-Fa-f], exactly 4 repetitions
		///          %[0-9A-Fa-f]{2}
		///              %
		///              Any character in this class: [0-9A-Fa-f], exactly 2 repetitions
		///  End of line or string
		///  
		///
		/// </summary>
		protected static Regex UrlRegex = new Regex(
			  "^(?:http|https|ftp)://[a-zA-Z0-9\\.\\-]+(?:\\:\\d{1,5})?(?:[" +
			  "A-Za-z0-9\\.\\;\\:\\@\\&\\=\\+\\$\\,_\\-\\?/]|%u[0-9A-Fa-f]{4}|%" +
			  "[0-9A-Fa-f]{2})*$",
			RegexOptions.IgnoreCase
			| RegexOptions.IgnorePatternWhitespace
			);


		static public bool ValidUrl(string url)
		{
			//// Test to see if there is a match in the InputText

			bool IsMatch = UrlRegex.IsMatch(url);
			return IsMatch;
		}

		///////////
		/// <summary>
		///  Regular expression built for C# on: ����, ��� 3, 2009, 10:32:25 PM
		///  Using Expresso Version: 3.0.3276, http://www.ultrapico.com
		///  
		///  A description of the regular expression:
		///  
		///  Match a suffix but exclude it from the capture. [^.{6,51}$]
		///      ^.{6,51}$
		///          Beginning of line or string
		///          Any character, between 6 and 51 repetitions
		///          End of line or string
		///  [1]: A numbered capture group. [[A-Za-z]{1}]
		///      Any character in this class: [A-Za-z], exactly 1 repetitions
		///  [2]: A numbered capture group. [[A-Za-z0-9!@#$%_\^\&amp;\*\-\.\?]{5,49}]
		///      Any character in this class: [A-Za-z0-9!@#$%_\^\&amp;\*\-\.\?], between 5 and 49 repetitions
		///  End of line or string
		///  
		///
		/// </summary>
		public static Regex UserNameRegex = new Regex(
			  "(?=^.{1,51}$)([A-Za-z]{1})([A-Za-z0-9!@#$%_\\^\\&amp;\\*\\-\\." +
			  "\\?]{0,49})$",
			RegexOptions.IgnoreCase
			| RegexOptions.IgnorePatternWhitespace
			);

		public static string UserNamePattern
		{
			get
			{
				return UserNameRegex.ToString();
			}
		}

		static public bool ValidUserName(string userName)
		{
			//// Test to see if there is a match in the InputText
			bool IsMatch = UserNameRegex.IsMatch(userName);
			return IsMatch;
		}

		/// <summary>
		///  Regular expression built for C# on: ����, ��� 3, 2009, 11:10:02 PM
		///  Using Expresso Version: 3.0.3276, http://www.ultrapico.com
		///  
		///  A description of the regular expression:
		///  
		///  ^\w+
		///      Beginning of line or string
		///      Alphanumeric, one or more repetitions
		///  Any character in this class: [\w-\.], any number of repetitions
		///  \@\w+
		///      Literal @
		///      Alphanumeric, one or more repetitions
		///  [1]: A numbered capture group. [(-\w+)|(\w*)]

		///      Select from 2 alternatives
		///          [2]: A numbered capture group. [-\w+]
		///              -\w+
		///                  -
		///                  Alphanumeric, one or more repetitions
		///          [3]: A numbered capture group. [\w*]
		///              Alphanumeric, any number of repetitions
		///  Literal .
		///  Any character in this class: [a-z], between 2 and 3 repetitions
		///  End of line or string
		///  
		///
		/// </summary>
		public static Regex EmailRegex = new Regex(
			  "^\\w+[\\w-\\.]*\\@\\w+((-\\w+)|(\\w*))\\.[a-z]{2,3}$",
			RegexOptions.IgnoreCase
			| RegexOptions.Multiline
			| RegexOptions.IgnorePatternWhitespace
			);

		public static string EmailPattern
		{
			get
			{
				return EmailRegex.ToString();
			}
		}

		static public bool ValidEmail(string email)
		{
			//// Test to see if there is a match in the InputText
			bool IsMatch = EmailRegex.IsMatch(email);
			return IsMatch;
		}


		// password

		//  using System.Text.RegularExpressions;

		/// <summary>
		///  Regular expression built for C# on: ����, ��� 4, 2009, 01:23:49 PM
		///  Using Expresso Version: 3.0.3276, http://www.ultrapico.com
		///  
		///  A description of the regular expression:
		///  
		///  Beginning of line or string
		///  Any character in this class: [a-zA-Z]
		///  \w{6,14}$
		///      Alphanumeric, between 6 and 14 repetitions
		///      End of line or string
		///  
		///
		/// </summary>
		public static Regex PasswordRegex = new Regex(
			  "^\\w{7,14}$",
			RegexOptions.IgnoreCase
			| RegexOptions.IgnorePatternWhitespace
			);


		public static string PasswordPattern
		{
			get
			{
				return PasswordRegex.ToString();
			}
		}

		static public bool ValidPassword(string password)
		{
			//// Test to see if there is a match in the InputText
			bool IsMatch = PasswordRegex.IsMatch(password);
			return IsMatch;
		}

		public static string WildcardToRegex(string pattern, bool addBeginAndEnd)
		{
			string returnRegEx = Regex.Escape(pattern).Replace("\\*", ".*").Replace("\\?", ".");
			if (addBeginAndEnd)
				return "^" + returnRegEx + "$";
			else
				return returnRegEx;
		}
	}
}




  //      7753 ProCG uses this line - don't edit it

2020 © iGenXSoft ProCG Generated Codes
pompy wtryskowe|cheap huarache shoes| bombas inyeccion|cheap jordans|cheap air max| cheap sneaker|wholesale jordans|cheap china jordans|cheap wholesale jordans