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

Valid SSN

Posted on May 22, 2014October 26, 2015 By David Kittell
using System.Text.RegularExpressions;

private bool validSSN(string ssn)
	{
		const string ssnPattern = @"^(?!000)([0-6]d{2}|7([0-6]d|7[012]))([ -])?(?!00)dd([ -|])?(?!0000)d{4}$";

		Regex regexSsn = new Regex(ssnPattern);
		if (regexSsn.IsMatch(ssn))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
Originally Posted on May 22, 2014
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 CSharp

Post navigation

Previous post
Next post

Related Posts

Truncate

Posted on February 21, 2013October 26, 2015

public static string Truncate(string source, int length) { if (source.Length > length) { source = source.Substring(0, length); } return source; } Originally Posted on February 21, 2013Last Updated on October 26, 2015 All information on this site is shared with the intention to help. Before any source code or program…

Read More

UNIX Bash – Domain List Get Whois Info

Posted on August 25, 2016September 2, 2016

If you manage a list of domains it’s sometimes helpful to have a script like this to check the information from time to time. I plan to clean this up in time but for now this works. First create a text file like below that has domains in it google.com…

Read More

PowerShell – Clear Temporary ASP.NET Files

Posted on October 13, 2019

If your Temporary ASP.NET Files directory is getting out of hand there are a few things you can do about it. First option I found was at https://sysadminspot.com/server-administration/powershell-cleanup-temp-asp-net-files/. Get-ChildItem “C:\Windows\Microsoft.NET\Framework*\v*\Temporary ASP.NET Files” -Recurse | Remove-Item -Recurse This option works well and in some cases could be the safer option as…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

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
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes