Asp Forum
Home
|
Login
|
Register
|
Search
Forums
>
comp.lang.ruby
Re: regex question
rlkeller
11/1/2007 10:59:00 PM
Note: parts of this message were removed by the gateway to make it a legal Usenet post.
Perfect! Thanks. I really got to get a better handle or regular expressions
------------------------------
Robert Keller
rlkeller@yahoo.com
----- Original Message ----
From: 7stud -- <bbxx789_05ss@yahoo.com>
To: ruby-talk ML <ruby-talk@ruby-lang.org>
Sent: Thursday, November 1, 2007 3:10:32 PM
Subject: Re: regex question
Jim Weirich 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
--
Posted via
http://www.ruby-...
.
Servizio di avviso nuovi messaggi
Ricevi direttamente nella tua mail i nuovi messaggi per
Re: regex question
Inserendo la tua e-mail nella casella sotto, riceverai un avviso tramite posta elettronica ogni volta che il motore di ricerca troverà un nuovo messaggio per te
Il servizio è completamente GRATUITO!
x
Login to ForumsZone
Login with Google
Login with E-Mail & Password