I'm trying to replace all characters that are not letters numbers and
white spaces in a string. I'm getting the characters eliminated in this
case a comma but the white space is eliminated to. How do I get around
that?
I think this does what you want, provided underscores are OK.
newTerms = string.gsub(/[^\w\s]/, "")
If underscores are not OK, then you'll need to change "\w" into "A-Za-z0-9".
Eric
···
On Wed, Jun 25, 2008 at 6:37 PM, Sam Ginko <ginkod@gmail.com> wrote:
I'm trying to replace all characters that are not letters numbers and
white spaces in a string. I'm getting the characters eliminated in this
case a comma but the white space is eliminated to. How do I get around
that?
On Wed, Jun 25, 2008 at 6:37 PM, Sam Ginko <ginkod@gmail.com> wrote:
I'm trying to replace all characters that are not letters numbers and
white spaces in a string. I'm getting the characters eliminated in this
case a comma but the white space is eliminated to. How do I get around
that?