Re: removing spaces between single characters with regual ex

From: ciapecki [mailto:[email protected]]

irb(main):006:0> s.gsub( /\b([a-z]) (?=[a-z]\b)/i, ‘\1’ )
=> “A long cat and a quick mouse met oj simpson on the tcp stack”

this is exactly what I need.
Is it possible to rewrite it without using lookahead (?=subexp) ?

I don’t think so, unless you have a positive lookbehind instead.

Why don’t you want the lookahead? Are you actually using this regexp
with a language other than Ruby?

Why don’t you want the lookahead? Are you actually using this regexp
with a language other than Ruby?

right. I need to write it later in oracle pl/sql, but right now wanted
to play a little with powerful ruby :slight_smile:
Thanks again for your help
chris