Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

C# ASPX Phone Number Validation

Posted on January 9, 2015October 26, 2015 By David Kittell
<asp:TextBox ID="RequestorPhone" runat="server" MaxLength="20" />
<asp:RequiredFieldValidator runat="server" ControlToValidate="RequestorPhone" Display="Dynamic" ErrorMessage="Phone # is required" />
<asp:RegularExpressionValidator ID="revPhone" runat="server" ControlToValidate="RequestorPhone" Display="Dynamic" ErrorMessage="Phone # is invalid" ValidationExpression="^(?:(?:+?1s*(?:[.-]s*)?)?(?:(s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])s*)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))s*(?:[.-]s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})s*(?:[.-]s*)?([0-9]{4})(?:s*(?:#|x.?|ext.?|extension)s*(d+))?$" />

Credit: fatcat1111 @ stackoverflow.com

Originally Posted on January 9, 2015
Last Updated on October 26, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Code MSSQL MSSQL - Ektron MSSQL - Ektron 8.7 SQL

Post navigation

Previous post
Next post

Related Posts

HomeBrew – Mac OS Setup

Posted on March 15, 2017May 7, 2021

I use a Mac for my primary computer and sometimes I need to setup a new VM similar to my computer for testing. Here is the basic setup that I use HomeBrew for. I’ll add more later as I remember more or use it more. # Install HomeBrew if !…

Read More

PHP – OpenSSL AES Encryption

Posted on October 26, 2015

This is currently setup as a three file setup, I can not remember where I originally found the code so I can not take full credit for this post. I use the code below to send a username and date\time to another page. If the date\time is within 2 minutes…

Read More

Date Compare

Posted on February 25, 2013October 26, 2015

<%@ Page Language="C#" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.Collections.Generic" %> <%@ Import Namespace="System.Linq" %> <%@ Import Namespace="System.Web" %> <%@ Import Namespace="System.Web.UI" %> <%@ Import Namespace="System.Web.UI.WebControls" %> <script runat="server"> protected void Button1_Click(object sender, EventArgs e) { DateTime date1 = Convert.ToDateTime(TextBox1.Text); DateTime date2 = new DateTime(DateTime.Now.Year – 1, 12, 18);…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • PowerShell - IIS Remove Site
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - FTP Upload Directory With Sub-Directories

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • PowerShell - IIS Remove Site
  • SQLite - Auto-Increment / Auto Generate GUID
  • PowerShell - FTP Upload Directory With Sub-Directories
  • Raspberry Pi - Remove Default Apps
  • PowerShell - Change Windows CD/DVD Drive Letter
©2025 David Kittell | WordPress Theme by SuperbThemes