473,320 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Need Help With Simple Regular Expression

Hello,

I need a regular expression that will allow alpha-numeric characters,
the underscore character, the period character, and the single quote
character.

The following is not working, for some reason...

[0-9a-zA-Z_.']

Can someone provide one that works?

May 23 '06 #1
7 1072
[0-9a-zA-Z_\.']+

May 23 '06 #2
Perhaps you're missing a quantifier:

[0-9a-zA-Z_.']

will match a single character.

[0-9a-zA-Z_.']* (0 or more)
[0-9a-zA-Z_.']+ (1 or more)
[0-9a-zA-Z_.']{X} (Exactly X)
[0-9a-zA-Z_.'] {X, Z} (Between X and Z)

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

The man who questions opinions is wise.
The man who quarrels with facts is a fool.

"Joey" <jo*********@topscene.com> wrote in message
news:11*********************@y43g2000cwc.googlegro ups.com...
Hello,

I need a regular expression that will allow alpha-numeric characters,
the underscore character, the period character, and the single quote
character.

The following is not working, for some reason...

[0-9a-zA-Z_.']

Can someone provide one that works?

May 23 '06 #3
I have a textbox where I need to take input and limit the characters to
"0-9", "a-z", "A-Z", single quote, period, and underscore, and spaces.

I added a regular expression validator to my webpage, but it is not
working properly with the ValidationExpression property set to the
following...

[0-9a-zA-Z_.']+

I understand that I still may need to add something to get it to allow
spaces, but it won't even work without any spaces at this point. The
input will be from 1-15 characters.

What am I doing wrong?

May 23 '06 #4
Any ideas, guys?

Joey wrote:
I have a textbox where I need to take input and limit the characters to
"0-9", "a-z", "A-Z", single quote, period, and underscore, and spaces.

I added a regular expression validator to my webpage, but it is not
working properly with the ValidationExpression property set to the
following...

[0-9a-zA-Z_.']+

I understand that I still may need to add something to get it to allow
spaces, but it won't even work without any spaces at this point. The
input will be from 1-15 characters.

What am I doing wrong?


May 24 '06 #5
Finally got it...

[0-9a-zA-Z_'.\s]+

May 24 '06 #6
Post your IsValid code.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

If the truth hurts, wear it.

"Joey" <jo*********@topscene.com> wrote in message
news:11**********************@38g2000cwa.googlegro ups.com...
Any ideas, guys?

Joey wrote:
I have a textbox where I need to take input and limit the characters to
"0-9", "a-z", "A-Z", single quote, period, and underscore, and spaces.

I added a regular expression validator to my webpage, but it is not
working properly with the ValidationExpression property set to the
following...

[0-9a-zA-Z_.']+

I understand that I still may need to add something to get it to allow
spaces, but it won't even work without any spaces at this point. The
input will be from 1-15 characters.

What am I doing wrong?

May 24 '06 #7
If that works for you, I would suggest the following instead:

[0-9a-zA-Z_'. ]+

This has a literal space at the end of the character class. "\s" indicates
that *any* whitespace character will match.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

If the truth hurts, wear it.

"Joey" <jo*********@topscene.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
Finally got it...

[0-9a-zA-Z_'.\s]+

May 24 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: EFP | last post by:
Can anyone help me with a simple regular expression problem. All that I want to do is take a list of known data and extract a particular section of the string to form a new list. Here is my...
7
by: Mike Kamermans | last post by:
I hope someone can help me, because what I'm going through at the moment trying to edit XML documents is enough to make me want to never edit XML again. I'm looking for an XML editor that has a...
10
by: Harlin Seritt | last post by:
I have been looking at the Python re module and have been trying to make sense of a simple function that I'd like to do. However, no amount of reading or googling has helped me with this. Forgive...
18
by: Q. John Chen | last post by:
I have Vidation Controls First One: Simple exluce certain special characters: say no a or b or c in the string: * Second One: I required date be entered in "MM/DD/YYYY" format: //+4 How...
8
by: moondaddy | last post by:
I'm writing an app in vb.net 1.1 and I need to parse strings that look similar to the one below. All 5 rows will make up one string. I have a form where a use can copy/paste data like what you...
17
by: Mark | last post by:
I must create a routine that finds tokens in small, arbitrary VB code snippets. For example, it might have to find all occurrences of {Formula} I was thinking that using regular expressions...
23
by: codefire | last post by:
Hi, I am trying to get a regexp to validate email addresses but can't get it quite right. The problem is I can't quite find the regexp to deal with ignoring the case james..kirk@fred.com, which...
14
by: Chris | last post by:
I need a pattern that matches a string that has the same number of '(' as ')': findall( compile('...'), '42^((2x+2)sin(x)) + (log(2)/log(5))' ) = Can anybody help me out? Thanks for any help!
3
by: TOXiC | last post by:
Hi everyone, First I say that I serched and tryed everything but I cannot figure out how I can do it. I want to open a a file (not necessary a txt) and find and replace a string. I can do it...
0
by: ahropak | last post by:
Hi, I have a question regarding a regular expression within Regex.Split() method which will help me to break each line of code into tokens. I'm trying to parse some lines of C# source code and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.