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,095
  • 13
  • 148
  • 192
Chris
  • 25,677
  • 44
  • 189
  • 332

1 Answers1

1

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

jscs
  • 63,095
  • 13
  • 148
  • 192
Chris
  • 25,677
  • 44
  • 189
  • 332