We help IT Professionals succeed at work.

isalpha(),isalphanumeric(),isnumeric()

Dewi
Dewi asked
on
I need all above functions in js (using regexp)
I don't want to create own function using a loop
Thanks
Comment
Watch Question

Michel PlungjanIT Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
isInteger = /^\d+$/;


if (isInteger.test(form.myField.value))...
IT Expert
CERTIFIED EXPERT
Top Expert 2009
Commented:

Author

Commented:
Hi mplungjan,

Thx for your prompt reply,
but what about isAlpha() and isAlphaNumeric() ?
Michel PlungjanIT Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
Yeah - I didn't have them off the top of my head.. I will look

Author

Commented:
Hi mplungjan,

Thx a lot, ur links was very useful

Author

Commented:
well done !

Author

Commented:
well done !
Michel PlungjanIT Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
\w was including the underscore so I think you want

isAlpha = /^\[a-zA-Z]+$/;
isAlphaNum=/^\[a-z0-0A-Z]+$/;

Author

Commented:
btw, i still can't find isAlpha()
can you help me on this ? thx

Author

Commented:
uppsss..  just ignored my last comment
thanks ...
Michel PlungjanIT Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
and change "+" to "*" if you allow the fields to be empty
Also make SURE it has
value=""
in the tag to make sure it is a string even when it is empty.
Michel PlungjanIT Expert
CERTIFIED EXPERT
Top Expert 2009

Commented:
ANd I had a typo: isAlphaNum=/^\[a-z0-0A-Z]+$/;
is
isAlphaNum=/^\[a-z0-9A-Z]+$/;