Here are some useful regex expressions for data generation in VSTS DB Pro
Thanks to Gert Drapers' blog: http://blogs.msdn.com/gertd/archive/2006/11/26/regex-is-your-friend.aspx
Simple gender representation:
- (F)emale or (M)ale using a single character representation (F|M)
- Mr or Mrs
Various phone number formats:
- Simple phone number formatted like 267-820-8446 (separated by dashes)
- [1-9][0-9]{2,2}-[1-9][0-9]{2,2}-[0-9]{4,4}
- Simple phone number formatted like (267) 820-8446
- \([1-9][0-9]{2,2}\) [1-9][0-9]{2,2}-[0-9]{4,4}
- Phone number within area code 425
- 425-[1-9][0-9]{2,2}-[0-9]{4,4}
- Phone number within area 425 or 206
- (206|425)-[1-9][0-9]{2,2}-[0-9]{4,4}
- Internal notation using country code 1 and area code 425 or 206
- \+1 (425|206)-[1-9][0-9]{2,2}-[0-9]{4,4}
ZIP codes:
- Simple ZIP code 5 digits plus 4 digits separated by a dash (like 98008-2405)
- ZIP code that starts in area 98xxxx
- Add state to zip code like WA 98322-1001
- WA 98[0-9]{3,3}-[1-9]{1,1}[0-9]{3,3}
Address:
- Create a simple address
- [1-6]{1}[0-9]{1,3} (SE|NE|NW|SW) [1-2]{1}[0-9]{1,2}th (ST|CT|PL|AVE), (Redmond, WA 9805[0-9]|Bellevue, WA 9800[1-9]|Sammamish, WA 9807[0-9]|Seattle, WA 9806[0-9]|Issaquah, WA 9808[0-9])
City names:
- List of city names
- Seattle|(New York)|Boston|Miami|Beijing|(Los Angles)|London|Paris
First & last names:
- List of first names
- (Pete|Tom|Mary|Larry|Lisa|Brain|David|Jeff|Amy)
- List of last names
- (Johnson|Smith|Good|Anderson|Baker|Crawford)
- List of name (first + last)
- (Pete|Tom|Mary|Larry|Lisa|Brain|David|Jeff|Amy) (Johnson|Smith|Good|Anderson|Baker|Crawford)
E-mail addresses:
- Simple email address
- [a-z]{5,8}@(hotmail\.com|msn\.com|[a-z]{3,8}\.(com|net|org))
Social Security number:
- [1-9][0-9]{2}-[0-9]{2}-[0-9]{4}
Credit card number:
- [1-9][0-9]{3} [0-9]{4} [0-9]{4} [0-9]{4}
Credit card names:
Shippers:
Comments
New Comments to this post are disabled
About rfustino
Russ wisely shelved dreams of rock and roll stardom in order to share his vast knowledge with developers nationwide. Given that he can’t sing or play an instrument, other than in Guitar Hero, we’re all very grateful. Russ has more than 25 years of software development. He’s the creator of the Russ' Tool Shed developer seminar series and has donned his trademark suspenders, hardhat and tool belt in presentations for over 75,000 developers at 1,700 events. Russ also has expertise in developing Visual Basic and Web-based solutions using Microsoft tools. Before joining Microsoft eleven years ago, Russ worked as a VB instructor, headed up a development department, and created several client/server applications and system software products. His specialties include development with VB.NET, XML Web services, ASP.NET, XNA, Silverlight, Development Tools and debugging. But make no mistake – Russ is not all brains. His big heart led him to establish Take a Swing at Cancer, Inc., a non-profit organization that holds softball and golf-based fundraisers to battle cancer. You have to know the code to get in the shed. KNOW THE CODE!