473,320 Members | 2,083 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.

Regular Expression Text

Hi,

I need to create a Regular Expression that will allow the user to enter
either apaha-numeric characters (a-z, A-Z, 0-9) or extended characters
(any extended character) (!@#$%^&*()) into a text field.

The alpha-numeric part is easy, it's the extended characters I'm having
trouble with. Does anybody have an example?

Thanks!

Jul 5 '06 #1
5 1609
Hello sianan,

AFAIK (nowhere to check), the \W is responsible for the symbols except a-z,
A-Z, 0-9
try to play with it

sHi,
s>
sI need to create a Regular Expression that will allow the user to
senter either apaha-numeric characters (a-z, A-Z, 0-9) or extended
scharacters (any extended character) (!@#$%^&*()) into a text field.
s>
sThe alpha-numeric part is easy, it's the extended characters I'm
shaving trouble with. Does anybody have an example?
s>
sThanks!
s>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
Jul 5 '06 #2
KH
If nothing is invalid why do you need/want to validate it?
"sianan" wrote:
Hi,

I need to create a Regular Expression that will allow the user to enter
either apaha-numeric characters (a-z, A-Z, 0-9) or extended characters
(any extended character) (!@#$%^&*()) into a text field.

The alpha-numeric part is easy, it's the extended characters I'm having
trouble with. Does anybody have an example?

Thanks!

Jul 5 '06 #3
It sounds to me like you'd be better off making a rule about what the user
can *not* put into the text box. I can't figure this out from what you've
posted.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
"sianan" <sm*********@tds.netwrote in message
news:11**********************@v61g2000cwv.googlegr oups.com...
Hi,

I need to create a Regular Expression that will allow the user to enter
either apaha-numeric characters (a-z, A-Z, 0-9) or extended characters
(any extended character) (!@#$%^&*()) into a text field.

The alpha-numeric part is easy, it's the extended characters I'm having
trouble with. Does anybody have an example?

Thanks!

Jul 5 '06 #4
"Kevin Spencer" <uc*@ftc.govwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
It sounds to me like you'd be better off making a rule about what the user
can *not* put into the text box. I can't figure this out from what you've
posted.
The user should not be able to enter a character that's not a-z, A-Z, 0-9,
!, @, #, $, %, ^, &, *, (, or ) .

This could be tested using

new Regex(@"^[\w\d!@#$%^&*()]+$").IsMatch(stringToTest);
"sianan" <sm*********@tds.netwrote in message
news:11**********************@v61g2000cwv.googlegr oups.com...
>Hi,

I need to create a Regular Expression that will allow the user to enter
either apaha-numeric characters (a-z, A-Z, 0-9) or extended characters
(any extended character) (!@#$%^&*()) into a text field.

The alpha-numeric part is easy, it's the extended characters I'm having
trouble with. Does anybody have an example?

Thanks!


Jul 5 '06 #5
Okay, it was your use of the term "extended characters" that was confusing.
The user should not be able to enter a character that's not a-z, A-Z, 0-9,
!, @, #, $, %, ^, &, *, (, or ) .
[^\w!^@#$%&*()]

This will do it. This is a character class that indicates that any character
*not* matching the characters you specified is a match. Therefore, if you
have a match, you have an illegal character in the string.

Note that it uses the shorthand "\w" ("word" characters - digits or
alphabetical characters). It does *not* include spaces. You would have to
add spaces to it for that:

[^\w\s!^@#$%&*()] (using the "\s" character shorthand for space characters)

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Chicken Salad Alchemist

Big thicks are made up of lots of little thins.
"Mark Wilden" <Ma********@newsgroups.nospamwrote in message
news:Ob****************@TK2MSFTNGP03.phx.gbl...
"Kevin Spencer" <uc*@ftc.govwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>It sounds to me like you'd be better off making a rule about what the
user can *not* put into the text box. I can't figure this out from what
you've posted.

The user should not be able to enter a character that's not a-z, A-Z, 0-9,
!, @, #, $, %, ^, &, *, (, or ) .

This could be tested using

new Regex(@"^[\w\d!@#$%^&*()]+$").IsMatch(stringToTest);
>"sianan" <sm*********@tds.netwrote in message
news:11**********************@v61g2000cwv.googleg roups.com...
>>Hi,

I need to create a Regular Expression that will allow the user to enter
either apaha-numeric characters (a-z, A-Z, 0-9) or extended characters
(any extended character) (!@#$%^&*()) into a text field.

The alpha-numeric part is easy, it's the extended characters I'm having
trouble with. Does anybody have an example?

Thanks!



Jul 6 '06 #6

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

Similar topics

1
by: Kenneth McDonald | last post by:
I'm working on the 0.8 release of my 'rex' module, and would appreciate feedback, suggestions, and criticism as I work towards finalizing the API and feature sets. rex is a module intended to make...
4
by: Buddy | last post by:
Can someone please show me how to create a regular expression to do the following My text is set to MyColumn{1, 100} Test I want a regular expression that sets the text to the following...
4
by: Neri | last post by:
Some document processing program I write has to deal with documents that have headers and footers that are unnecessary for the main processing part. Therefore, I'm using a regular expression to go...
3
by: James D. Marshall | last post by:
The issue at hand, I believe is my comprehension of using regular expression, specially to assist in replacing the expression with other text. using regular expression (\s*) my understanding is...
2
by: Brian Kitt | last post by:
I have a process where I do some minimal reformating on a TAB delimited document to prepare for DTS load. This process has been running fine, but I recently made a change. I have a Full Text...
7
by: Billa | last post by:
Hi, I am replaceing a big string using different regular expressions (see some example at the end of the message). The problem is whenever I apply a "replace" it makes a new copy of string and I...
9
by: Pete Davis | last post by:
I'm using regular expressions to extract some data and some links from some web pages. I download the page and then I want to get a list of certain links. For building regular expressions, I use...
25
by: Mike | last post by:
I have a regular expression (^(.+)(?=\s*).*\1 ) that results in matches. I would like to get what the actual regular expression is. In other words, when I apply ^(.+)(?=\s*).*\1 to " HEART...
0
by: altavim | last post by:
Usually when you make regular expression to extract text you are starting from simple expression. When you got to know target text, you are extending your expression. Subsequently very hard to ready...
14
by: Andy B | last post by:
I need to create a regular expression that will match a 5 digit number, a space and then anything up to but not including the next closing html tag. Here is an example: <startTag>55555 any...
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
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
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....

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.