Reg Exp how to search for only numbers, letters, and spaces

Posted on 2003-03-12
Medium Priority
Last Modified: 2008-02-01
I'm trying to allow only letters, numbers and spaces when checking a value.

The code below only allows letters and numbers, but not spaces.

How do I change the .Pattern to allow spaces too.

'Use regexp to make sure that password has only chars a-z and 0-9
Set RegularExpressionObject3 = New RegExp
With RegularExpressionObject3
    .Pattern = "\W+"
    .IgnoreCase = True
    .Global = True
End With
expressionmatch3 = RegularExpressionObject3.Test(TempVal)
     If expressionmatch3 = true Then ErrorCode = 3
Set RegularExpressionObject3 = Nothing

Question by:zippyuk
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

lavinder earned 200 total points
ID: 8118534
try to use
LVL 15

Expert Comment

ID: 8118655

try to use this


this will search for alaphanumeric numeric


HAppy programming...

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question