Stripping non-alphanumeric chars but leaving spaces in Ruby

ruby, string

Solution

You can simply add `\s` (whitespace)

`string.downcase.gsub(/[^a-z0-9\s]/i, '')`

Problem

Trying to change this: ``` "The basketball-player is great! (Kobe Bryant)" ``` into this: ``` "the basketball player is great kobe bryant" ``` Want to downcase and remove all punctuation but leave spaces... Tried `string.downcase.gsub(/[^a-z ]/, '')` but it removes the spaces

Original source