I am trying to remove extra characters from a title that the user types in to make it more URL-friendly. I am trying to use preg_replace() for it, but I keep getting errors. Here's my code:
$urlFriendlyTitle = preg_replace("/[/", "", $_POST['title']);
$urlFriendlyTitle .= preg_replace("/]/", "", $urlFriendlyTitle);
$urlFriendlyTitle .= preg_replace('/ /', '_', $urlFriendlyTitle);
When I remove the space it's fine, but trying to remove brackets just doesn't work. I haven't tried to remove Quotaion Marks or Slashes/ other characters yet(ex @, #, $, &, etc..), but hopefully I can figure that out once I fix the bracket problem.