From: Dan Diebolt Date: 2008-03-14T07:00:04+09:00 Subject: Re: use reqex to get the middle character and repeat it --0-722892918-1205445199=:44602 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Don't use a regexp. It isn't clear what you want to happen if there isn't a middle character if the string has a odd integer for its length. Try using some type of substring approach such as this: str = "xxx" str[0..str.length/2-1] + str[str.length/2,1] * 4 + str[str.length/2+1..str.length] => "xxxxxx" --0-722892918-1205445199=:44602--