George Moschovitis wrote: >Hello everyone! > >I have a question regarding regular expressions. Let me explain >with an example. I have the string: > >"{b}Text{/b} kokoko {b}Lalal{/b}" > >and i want to convert it to this string > >"<b>Text</b> kokoko <b>Lalal</b>" > >if I use the following gsub: > >str.gsub!(/\{b\}(.*)\{\/b\}/, '<b>\1</b>') > > try this str.gsub!(/\{b\}(.*?)\{\/b\}/, '<b>\1</b>') at the moment the .* is being too greedy when it's matching, causing it to match Text{/b} kokoko {b}Lalal Using .*? switches off the greedy matching so it only matches up to the first {/b} HTH -- Mark Sparshatt