473,511 Members | 15,581 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pasrsign a Text Box

68 New Member
thanawala27
Newbie
22 Posts May 21st, 2007
08:10 PM
#1


Parse a textbox
--------------------------------------------------------------------------------

Hi,
I had a Question!

i have a textbox, where i have filled some value.

say "ABBC2122"

now i want to check whether the value entered starts with ABBC or not.
In short, I want to parse the Value of the textbox and match it with another string.

Any Advice will be appreciated

Thanks

Ravi

--------------------------------------------------------------------------------

Reply
r035198x
Admin
4,690 Posts Yesterday
06:15 AM
#2


Re: Parse a textbox
--------------------------------------------------------------------------------

Quote:
Originally Posted by thanawala27
Hi,
I had a Question!

i have a textbox, where i have filled some value.

say "ABBC2122"

now i want to check whether the value entered starts with ABBC or not.
In short, I want to parse the Value of the textbox and match it with another string.

Any Advice will be appreciated

Thanks

Ravi


I think there's a startsWith method that you can use, otherwise a simple regular expression will work for you.

--------------------------------------------------------------------------------

Report Reply
gits
Member
41 Posts Yesterday
06:33 AM
#3


Re: Parse a textbox
--------------------------------------------------------------------------------

yep ... an easy way would be to use an RegEx ... have a look at the following example:


Code: ( javascript )
// your textbox-value
var foo = "ABBC2122";

// test it with a simple RegEx - i use the literals here and call the testmethod
// instantly on var foo
var check = /^ABBC/.test(foo);

// check is now true ;)

// you may also use the constructor for the RegEx and ref it with a variable
// for later reuse and/or !! if you want to create a RegEx with a variable
// new RegExp(yourvar, options)
var re = new RegExp('^ABBC');

// now we use re and call the testmethod
check = re.test(foo);

// of course: check is true again


hope this helps ... and kind regards

--------------------------------------------------------------------------------

Report Reply
thanawala27
Newbie
22 Posts Today
02:11 PM
#4


Re: Parse a textbox
--------------------------------------------------------------------------------

hey guys,
thanks for ur replies

Gits, i tried wot u said, n yes it worked..
now i met with another issue..
now i want the end a string with 5 digits
so my valid string shud be "ABBC65278"...
ABCC shud be followed by only 5 digits....anything else is an invalid string

i think we need ot break the string for this...break the first 4 and the last 5...then do the checking...

can u guys help me out here

Thanks

Ravi
May 23 '07 #1
1 1135
drhowarddrfine
7,435 Recognized Expert Expert
This thread was moved to another forum because HTML cannot do this. You can find the link further down the list. Do not copy and double post it. I will close this one.
May 23 '07 #2

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

Similar topics

2
2863
by: Jürgen Holly | last post by:
Hi! I have the following xml-node: <docu> <p>Sample: <b>bold</b></p> <p>and text in <i>italic</i></p> </docu> I need to create a text-file, so I set the output-mode to text.
2
3116
by: Martin | last post by:
Hallo, can you help me writing a generic xslt transformation (useable with xsql from oracle)? The problem is how to get the escaping characters .... === INPUT-File in.xml <?xml version =...
3
22994
by: Xerxes | last post by:
Hi, I need help in setting up a page where the text wraps around an image. Right now, I am using table, with text in one <td> and the image in the adjacent <td>. The problem is when the text is...
2
7560
by: Macsicarr | last post by:
Hi All Wonder if you could help me. I have created a CMS system that allows the user to enter text and pic 'tags' for their own About us page, eg text.... text.... text.... text.......
4
2587
by: Arif Çimen | last post by:
Hi to everybody, I have chnged a button text in design mode. But After compiling and executing the program the text of the button do not change to new value. Any Ideas? Thaks for helps.
3
2558
by: jweinberg1975 | last post by:
I would like for users to be able to select from a small number of options that come from a little drop down menu which then closes. .....
3
2151
by: bbepristis | last post by:
Hey all I have this code that reads from one text file writes to another unless im on a certian line then it writes the new data however it only seems to do about 40 lines then quits and I cant...
3
3969
by: acecraig100 | last post by:
I am fairly new to Javascript. I have a form that users fill out to enter an animal to exhibit at a fair. Because we have no way of knowing, how many animals a user may enter, I created a table...
3
2574
by: jonniethecodeprince | last post by:
Hi all, I have trouble getting an array of data stored in a separate javascript file i.e. a file called books.js into a table of data for a .xhtml file. There are 50 Records in this file....
10
3167
by: bluemountain | last post by:
Hi there, Iam new to python forms and programming too I had a text file where i need to extract few words of data from the header(which is of 3 lines) and search for the keyword TEXT1, TEXT2,...
0
7144
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
7356
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,...
1
7085
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7512
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...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4741
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...
0
3227
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...
0
1577
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 ...
1
785
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.