Prettier regexp, paid for with two more steps:

 msg = "THIS is a Text and (NO Change HERE) HELP (Not here Either)"

 (")"+msg+"(").gsub(/\)(.*?)\(/) {|i| i.downcase}[1..-2]

martin

On 10/22/06, Scott <bauer.mail / gmail.com> wrote:
> Certainly not pretty with that funky regex, but it works:
>
> msg = "THIS is a Text and (NO Change HERE) HELP (Not here Either)"
>
> msg.gsub!(/([^\(]*(?!\())|(\(.*?\))|(\)[^\)]*\))/) do |m|
>         m[0] == 40 ? m : m.downcase
> end
>
> - Scott
>
> ilhamik wrote:
> > hi,
> > I want to downcase a string but without specific parts.
> > for example:
> > msg = "THIS is a Text and (NO Change HERE) HELP"
> >
> > after downcase it should look like "this is a text and (NO Change HERE)
> > help"
> >
> > I don't want to downcase the letters in parentheses.
> > How can i do that, i  tried it with regular expressions but can't do
> > it.
> >
> > Thanks for any help
>
>
>