Crescionini Sascha wrote on 22 jul 2003 in comp.lang.javas cript:
[color=blue]
> 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 ",,gagaggig i"
>
> any ideas?
>[/color]
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)
Evertjan. wrote on 22 jul 2003 in comp.lang.javas cript:
[color=blue]
> Crescionini Sascha wrote on 22 jul 2003 in comp.lang.javas cript:
>[color=green]
>> 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 ",,gagaggig i"
>>
>> any ideas?
>>[/color]
>
> s = "gaga,gogo,gugu ";
> n= s.replace(/[^,]+/g,"").length;
> alert(n);
>
> [the + speeds things up, says John S.]
>[/color]
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)
"Evertjan." <exjxw.hannivoo rt@interxnl.net > wrote in message
news:Xns93C09B5 43A240eejj99@19 4.109.133.29...[color=blue]
> Evertjan. wrote on 22 jul 2003 in comp.lang.javas cript:
>[color=green]
> > Crescionini Sascha wrote on 22 jul 2003 in comp.lang.javas cript:
> >[color=darkred]
> >> 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 ",,gagaggig i"
> >>
> >> any ideas?
> >>[/color]
> >
> > s = "gaga,gogo,gugu ";
> > n= s.replace(/[^,]+/g,"").length;
> > alert(n);
> >
> > [the + speeds things up, says John S.]
> >[/color]
>
> 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)[/color]
Comment