JeremyCanada26 Posted August 8, 2010 Share Posted August 8, 2010 I'm filtering user input and am trying to find out which php function that I use to filter the user input? $user_input = trim($_GET['value']); my regex that I'm using is this, ^(?:[a-z]|([-_ ])(?!.*[^a-z\1])){5,45}$ whenever any of the violations of the more than 1 space or more than 1 dash or more than one underscore, I want to just trim those down to 1 and continue using the existing $user_input with the invalid chars removed but I don't know which php function to use for that. Link to comment https://forums.phpfreaks.com/topic/210162-which-php-regex-function-do-i-use-to-strip-out-from-user-input-string/ Share on other sites More sharing options...
Adam Posted August 10, 2010 Share Posted August 10, 2010 preg_replace ? Link to comment https://forums.phpfreaks.com/topic/210162-which-php-regex-function-do-i-use-to-strip-out-from-user-input-string/#findComment-1097485 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.