|
-
January 7th, 2013, 05:56 PM
#1
[RESOLVED] Regular Expressions and Javascript Help needed
In need of some reg exp assistance, I would like to remove all characters from a user's input except for those I designate. I have it working all except if a space is added which I would like to keep. I have included the code I am using below. As you can see, I would like to keep all alphanumerics as well as ?, *, and -. I have tried added \s inside and outside the brackets and the spaces remain; however the end user can use special characters (%, #, &, etc) which I want to disallow.
document.getElementById("trackingID").value = acctNum.replace(/[^\A-Za-z0-9?*-]/g, "");
Maybe I am going about this the wrong way and should use something other than a regular expression. I am open for any suggestions
Thanks in advance.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|