Regular expressions interview questions and answers


This document helps the reader prepare for regular expressions interview questions. It also includes the answers, with detailed explanations and source code.

What's included in the purchase

PDF file with the following:

  • Refresher on regular expressions
  • Resources to test your regular expression syntax
  • Answer to the interview question, Develop a regular expression to match a US phone number.
  • Answer to the interview question, Show different ways of matching digits and non-digits using regular expressions.
  • Answer to the interview question, Explain the different ways to match words and non-words.
  • Answer to the interview question, Write a regular expression to match anything that is a non-space.
  • Answer to the interview question, Write a regular expression to match words that are exactly 7 characters in length and start with P and end with D.
  • Answer to the interview question, Find all the occurrences of the, The and THE.
  • Answer to the interview question, Find all the even numbers between 0 and 99.
  • Answer to the interview question, Identify hexadecimal numbers in a string of numbers.
  • Answer to the interview question, Ignore all vowels in the given text.
  • Detailed explanations for all regular expression answers


4 pages



About the author 

The author has over 15 years of experience as architect and engineering director for several Fortune 500 companies.  He loves programming interviews and writes frequently on the topic.  Here are some additional details about the author:

- Expert in C#, .NET, ASP.NET, XML, XSLT, enterprise JAVA and client side technologies

- Extensive experience in C, C++, VB.Net, ASP, UML, Design Patterns and SEO

- Proficient in major databases including Microsoft SQL Server and Oracle

- In-depth knowledge of cloud providers including Amazon AWS and Microsoft Azure

- Clear understanding of all 3 major mobile platforms – iOS, Android and Windows Phone