0

I have the following code that should strip all non-alphanumeric characters (excluding hyphens) from some text. It somehow misses square brackets somehow, however.

ereg_replace('[^A-z0-9-]', '', strtolower(str_replace(' ','-',$title)))

Can anyone advise?

jscs
  • 63,694
  • 13
  • 151
  • 195
Chris
  • 26,744
  • 48
  • 193
  • 345

1 Answers1

1

I made a mistake and wrote A-z instead of a-z. A-z encompasses the [ and ] characters.

jscs
  • 63,694
  • 13
  • 151
  • 195
Chris
  • 26,744
  • 48
  • 193
  • 345