bigt95nt0110 Posted November 18, 2012 Share Posted November 18, 2012 I am trying to strip all nonprintable chars from text excep the n. I am using the .replace(,) method to acomplosh this, but only having limited sucess. Is there any tutorials on the arguments that get passed to .replace()? Link to comment Share on other sites More sharing options...
Ingolme Posted November 18, 2012 Share Posted November 18, 2012 There are some pages regarding Regular Expressions on W3Schools. For more in-depth reading on the subject, go to http://regular-expressions.info Link to comment Share on other sites More sharing options...
redtoline Posted November 18, 2012 Share Posted November 18, 2012 replace(/[a-z0-9~`\!@#\$%\^&\*\(\)\-_\+\=\{\[\}\]\|\\\:;\'\"<\,>\.\?\/\n\r]/gi, '') Link to comment Share on other sites More sharing options...
redtoline Posted November 18, 2012 Share Posted November 18, 2012 (edited) My apologies, forgot the negation operator: replace(/[^a-z0-9~`\!@#\$%\^&\*\(\)\-_\+\=\{\[\}\]\|\\\:;\'\"<\,>\.\?\/\n\r\s\t]/gi, '') Edited November 18, 2012 by redtoline Link to comment Share on other sites More sharing options...
Ingolme Posted November 18, 2012 Share Posted November 18, 2012 That's nice, but your not actually explaining how you came up with that code and why it works. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now