Re: regex question

Perfect! Thanks. I really got to get a better handle or regular
expressions


Robert K.
[email protected]

----- Original Message ----
From: 7stud – [email protected]
To: ruby-talk ML [email protected]
Sent: Thursday, November 1, 2007 3:10:32 PM
Subject: Re: regex question

Jim W. wrote:

Is this what you want:

str.gsub(/([^0-9])\b\s\b([^0-9])/) { "#$1-#$2" }

Or simply:

new_str = str.gsub(/([a-zA-Z]) ([a-zA-Z])/) {“#$1-#$2”}
puts new_str

–output:–
this-is-text-that I want-to 9 9.90 89 9 ii8 u