Jump to content

Which php regex function do I use to strip out from user input string?


JeremyCanada26

Recommended Posts

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.

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.