473,387 Members | 1,619 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,387 software developers and data experts.

formfield requires 2 commas


hello ng

does anyone have an idea how to check in an input field,
if the value contains exactly two commas?

examples:
"gaga,gogo,gugu" or ",,gagaggigi"

any ideas?

sascha


Jul 20 '05 #1
3 1686
Crescionini Sascha wrote on 22 jul 2003 in comp.lang.javascript:
hello ng

does anyone have an idea how to check in an input field,
if the value contains exactly two commas?

examples:
"gaga,gogo,gugu" or ",,gagaggigi"

any ideas?


s = "gaga,gogo,gugu";
n= s.replace(/[^,]+/g,"").length;
alert(n);

[the + speeds things up, says John S.]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #2
Evertjan. wrote on 22 jul 2003 in comp.lang.javascript:
Crescionini Sascha wrote on 22 jul 2003 in comp.lang.javascript:
hello ng

does anyone have an idea how to check in an input field,
if the value contains exactly two commas?

examples:
"gaga,gogo,gugu" or ",,gagaggigi"

any ideas?


s = "gaga,gogo,gugu";
n= s.replace(/[^,]+/g,"").length;
alert(n);

[the + speeds things up, says John S.]


O sorry, you wanted a test:

s = "gaga,gogo,gugu";
if(s.replace(/[^,]+/g,"").length==2)alert("Yes");
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 20 '05 #3
hi

thank you very much, works great!!!

greets
sascha

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
Evertjan. wrote on 22 jul 2003 in comp.lang.javascript:
Crescionini Sascha wrote on 22 jul 2003 in comp.lang.javascript:
hello ng

does anyone have an idea how to check in an input field,
if the value contains exactly two commas?

examples:
"gaga,gogo,gugu" or ",,gagaggigi"

any ideas?


s = "gaga,gogo,gugu";
n= s.replace(/[^,]+/g,"").length;
alert(n);

[the + speeds things up, says John S.]


O sorry, you wanted a test:

s = "gaga,gogo,gugu";
if(s.replace(/[^,]+/g,"").length==2)alert("Yes");
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 20 '05 #4

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

Similar topics

22
by: ineedyourluvin1 | last post by:
Hello all! I've been looking for a way to strip characters from strings such as a comma. This would be great for using a comma as a delimiter. I show you what I have right now. ...
7
by: AES | last post by:
Encountered a URL containing a comma the other day -- the first time I've ever noticed that, so far as I can recall. It worked fine, however, and I gather commas are legal in URLs. Out of...
0
by: David | last post by:
What's the cleanest way to import formfield data into a .net windows application (vb or c#) from a Word document?
27
by: Peter Ammon | last post by:
My code obfuscator gave me this: char buff; to which gcc retorted: "ISO C90 forbids variable-size array 'buff'" and checking the standard, it appears that commas are indeed forbidden...
3
by: Robert Scheer | last post by:
Hi. I have a regularexpression validator control on a page. This regular expression validates a textbox to accept only numbers and commas: validationexpression="*" I am trying to modify this...
4
by: striker | last post by:
I have a comma delimited text file that has multiple instances of multiple commas. Each file will contain approximatley 300 lines. For example: one, two, three,,,,four,five,,,,six one, two,...
0
by: Elroyskimms | last post by:
I am trying to POST the following to a URL: type="FORMFIELD" name="xml_string" value= type="FORMFIELD" name="account_number" value="ABC123" type="FORMFIELD" name="job_tracker" value="123456"...
3
by: Donkeyoz | last post by:
Hi all, Trying to do something fairly basic but am getting caught up on it. I am trying to extract text from a .txt file into an array line by line and then dissect that line into various parts,...
1
by: jlt206 | last post by:
This code <?php include("counter.php")?> on the webpage produces the count number. (function code below) I want to place the current number into a variable $MemberNo or into a FormField to be sent...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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,...

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.