Login or Sign Up
Logging in...
Remember me
Log in
Or
Sign Up
Forgot password or user name?
Log in with
Search in titles only
Search in Javascript only
Search
Advanced Search
Forums
Product Launch
Updates
Today's Posts
Member List
Calendar
Home
Forum
Topic
Javascript
How to check illegal characters excluding space?
Collapse
X
Collapse
Posts
Latest Activity
Photos
Page
of
1
Filter
Time
All Time
Today
Last Week
Last Month
Show
All
Discussions only
Photos only
Videos only
Links only
Polls only
Events only
Filtered by:
Clear All
new posts
Previous
template
Next
Archit Gupta
New Member
Join Date:
Jul 2010
Posts:
4
#1
How to check illegal characters excluding space?
Jul 30 '10, 08:10 AM
i tried \w but it shows error in space...what to do...
var illegalChars = /\W/;
if (illegalChars.t est(str))
Dormilich
Recognized Expert
Expert
Join Date:
Aug 2008
Posts:
8694
#2
Jul 30 '10, 11:14 AM
what is your definition of an "illegal character"?
Comment
Post
Cancel
Archit Gupta
New Member
Join Date:
Jul 2010
Posts:
4
#3
Jul 30 '10, 05:08 PM
basically i want to check use of characters other than space,'(',')' n alphabets...
Comment
Post
Cancel
Dormilich
Recognized Expert
Expert
Join Date:
Aug 2008
Posts:
8694
#4
Jul 31 '10, 09:03 AM
define "alphabets" (if you’re considering Unicode, that accounts for more than 10,000 characters)
Comment
Post
Cancel
Archit Gupta
New Member
Join Date:
Jul 2010
Posts:
4
#5
Jul 31 '10, 10:24 AM
basically i want to check use of characters other than space n alphanumeric characters of basic english...i want this in a form validation...fo r username...
Comment
Post
Cancel
Dormilich
Recognized Expert
Expert
Join Date:
Aug 2008
Posts:
8694
#6
Jul 31 '10, 12:28 PM
then your illegal characters are roughly [^\w ] (still includes underscore) or [0-9a-z ] (using the i parameter)
Comment
Post
Cancel
Archit Gupta
New Member
Join Date:
Jul 2010
Posts:
4
#7
Jul 31 '10, 01:30 PM
Originally posted by
Dormilich
then your illegal characters are roughly [^\w ] (still includes underscore) or [0-9a-z ] (using the i parameter)
yes...but [^\w] includes space. n i dont want it as an illegal character in the if statement in my first post on this thread...
Comment
Post
Cancel
Dormilich
Recognized Expert
Expert
Join Date:
Aug 2008
Posts:
8694
#8
Aug 1 '10, 04:20 PM
guess why I proposed [^\w ] …
Comment
Post
Cancel
Previous
template
Next
Working...
Yes
No
OK
OK
Cancel
👍
👎
☕
Comment