473,396 Members | 2,158 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,396 software developers and data experts.

Allow Only PRE Defined Characters . .

65
Hi All,

I am trying to include only the following characters in my textbox. Will anyone please provide me some source code or idea . .

Textbox must accept only 0-9, space ,hypens(-) and characters(a,b and Z)

Regards,
Nedu. M
Dec 6 '07 #1
5 2379
gits
5,390 Expert Mod 4TB
hi ...

you may use a regEx for that purpose:

Expand|Select|Wrap|Line Numbers
  1. var re = /^[0-9abZ-]+$/;
  2. var value = '12-aZ';
  3.  
  4. var ret = re.test(value);
kind regards
Dec 6 '07 #2
clai83
41
hi ...

you may use a regEx for that purpose:

Expand|Select|Wrap|Line Numbers
  1. var re = /^[0-9abZ-]+$/;
  2. var value = '12-aZ';
  3.  
  4. var ret = re.test(value);
kind regards
Don't mean to haggle you gits and I don't mean to intrude, but nudu I think wanted spaces as well.

Expand|Select|Wrap|Line Numbers
  1.      var re = /^[0-9abZ\s-]+$/
  2.  
should add the white space characters. If you don't want tabs and such, then try the following.

Expand|Select|Wrap|Line Numbers
  1.      var re = /^[0-9abZ\x20-]+$/
  2.  
\x20 being the space character in hexidecimal.

Please correct me if I'm wrong.
Dec 7 '07 #3
gits
5,390 Expert Mod 4TB
yep ... i missed the spaces ... thanks for pointing that out ...
Dec 8 '07 #4
nedu
65
Thanks a lot for all . . I got t . . .
Dec 11 '07 #5
gits
5,390 Expert Mod 4TB
glad to hear that ;) ... post back to the forum anytime you have more questions ...

kind regards
Dec 11 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: Eric Lilja | last post by:
Hello, I had what I thought was normal text-file and I needed to locate a string matching a certain pattern in that file and, if found, replace that string. I thought this would be simple but I had...
13
by: dawatson833 | last post by:
I have several stored procedures with parameters that are defined with user defined data types. The time it takes to run the procedures can take 10 - 50 seconds depending on the procedure. If I...
3
by: Leiji Liu | last post by:
Hi, I am curious if there are any pre-defined varables (constants?) in C? I saw some code with __LINE__, __FILE__, etc. Are those located in some include files? LL
54
by: Sathyaish | last post by:
I am trying to print to the printer. I am using a VC++ 6.0 compiler on Win 2K, but I get an error saying that stdprn is not defined. Why is that? Is it because of Windows, I am guessing? Do I have...
14
by: Adam Clauss | last post by:
I've an application which is using a multiline textbox to log the status of a fairly long procedure. "Updates" are made to the status by calling textbox.AppendText. As my task is fairly lengthy,...
11
by: tlyczko | last post by:
Hello Rob B posted this wonderful code in another thread, http://groups.google.com/group/comp.lang.javascript/browse_thread/thread/c84d8538025980dd/6ead9d5e61be85f0#6ead9d5e61be85f0 I could not...
6
by: karthi | last post by:
hi, I need user defined function that converts string to float in c. since the library function atof and strtod occupies large space in my processor memory I can't use it in my code. regards,...
1
by: sonald | last post by:
Dear All, I am working on a module that validates the provided CSV data in a text format, which must be in a predefined format. We check for the : 1. Number of fields provided in the text file,...
85
by: pereges | last post by:
#include <stdio.h> typedef struct { double x, y, z; }vector; int main(void) { int i;
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.