• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is there a regular expression i can use to search for bad characters in form submisssion

 
Christopher Whu
Ranch Hand
Posts: 80
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i created a form to gather client data... I am looking for a regex that i can use to test the data i am collecting against characters that hackers use... I only want alpha numeric and normal punctuation...

something like
var specials = new RegExp(/^[a-zA-Z_0-9]$/);

is this worth the effort.

is there a better regex i can use?
 
shankhas sanyal
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Christopher Whu wrote:i created a form to gather client data... I am looking for a regex that i can use to test the data i am collecting against characters that hackers use... I only want alpha numeric and normal punctuation...

something like
var specials = new RegExp(/^[a-zA-Z_0-9]$/);

is this worth the effort.

is there a better regex i can use?


you can use form validation and use that to weed out sql injection and other hacker tactics
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!