Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 7
[Jquery] regex
Hey ! Help about jquery regex I've an input and I want to check if user write other than 0 and 1. If he write 2,3,4 etc... or 12 etc... and if the number contains other than 0 and 1 it write 'error' example : value of the input = '10001010111' -> true value of the input = '12' -> false : contains other number than 0 or 1
13 Respostas
+ 6
/^[01]*$/.test(input) // return true if only 0 and/or 1
replace the '*' with '+' to get false for empty string...
> '*' means any times, '+' means one or more times
> '^' at start means start of the string, '#x27; at end means end of the string
> '[]' define a class of possible char
> regex.test(string) return true if pattern match
+ 17
ok
+ 17
ok
+ 15
Alors tas choisi qui pour le challenge ?
+ 14
Coucou
+ 5
Je ne sais plus de quelle autre fois tu parles... ( et j'men fous un peu beaucoup ;P )
Fais comme tu veux, mais sache que le principe initial de la marque pour la meilleure rĆ©ponse est de signaler aux lecteurs la rĆ©ponse la plus utile, pas nĆ©cessairement la premiĆØre donnĆ©e...
+ 5
ah ouai pas faux du tout :/
+ 4
So you want only jQuery no Javascript?
+ 4
So, mark it as best answer, maybe ^^
+ 4
yop
+ 3
attends je fini un truc et je te dis ;)
+ 2
thanks for all this explanations Visph ! :) really help me
+ 2
mdr honnĆŖtement je voudrais bien mais le mec avec un pseudo ultra long dont j'ai la flemme de recopier Ć dit la rĆ©ponse avant, et si je te mets la meilleure rĆ©ponse, Ƨa lui enlĆØve du coup, et Ƨa ferait comme toi la derniĆØre fois quand tu t'es fĆ¢chĆ©. ... sauf que lĆ ce serait lui.... alors jsp quoi faire