473,770 Members | 2,135 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Allow Only PRE Defined Characters . .

65 New Member
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 2399
gits
5,390 Recognized Expert Moderator Expert
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 New Member
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 Recognized Expert Moderator Expert
yep ... i missed the spaces ... thanks for pointing that out ...
Dec 8 '07 #4
nedu
65 New Member
Thanks a lot for all . . I got t . . .
Dec 11 '07 #5
gits
5,390 Recognized Expert Moderator Expert
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
4066
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 problems getting my algorithm to work and in order to help me find the solution I decided to print each line to screen as I read them. Then, to my surprise, I noticed that there was a space between every character as I outputted the lines to the...
13
10447
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 change the parameter data types to the actual data type such as varchar(10), etc., the stored procedure takes less that a second to return records. The user defined types are mostly varchar, but some others such as int. They are all input type...
3
5080
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
8997
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 to use only the GDI32 functions for printing under Windows? Can I not use the stdprn under Windows to print from memory to the window?
14
7611
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, I go well past the default max text length of the textbox. According to the documentation, setting MaxLength = 0 will increase this to basically the limit of available memory. So, in the form designer, I set the MaxLength property equal to 0. ...
11
11944
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 figure out how to reply to the thread per se using Google Groups and so please forgive me for cutting and pasting (I emailed him but he may not have time to check his email), and I am hoping someone might be able to tell me how I can change this...
6
7610
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, Karthi
1
4574
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, 2. Text checks for max. length of the field & whether the field is mandatory or optional Example:
85
2438
by: pereges | last post by:
#include <stdio.h> typedef struct { double x, y, z; }vector; int main(void) { int i;
0
9591
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10057
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9869
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8883
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6676
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5312
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5449
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3970
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2816
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.