Regular expression problem

string="something <a a> somethig <a a> something"

now i want to change /<a.*a>/ to "tag"
i want result like this

string="something tag somethig tag something"

but when i try

string =~ /<a.*a>/ # here $& --->"<a a> somethig <a a>"
$`+'tag'+$' # 'something tag something'

how can i change each tag ?

any idea ?

···

--
Posted via http://www.ruby-forum.com/.

# string="something <a a> somethig <a a> something"
# now i want to change /<a.*a>/ to "tag"
# i want result like this
# string="something tag somethig tag something"

:008:0> string="something <a a> somethig <a a> something"
=> "something <a a> somethig <a a> something"
:009:0> string.gsub(/<a.*?a>/,'tag')
=> "something tag somethig tag something"

kind regards -botp

···

From: bad_good_lion@yahoo.com [mailto:bad_good_lion@yahoo.com]

Peña, Botp wrote:

:009:0> string.gsub(/<a.*?a>/,'tag')
=> "something tag somethig tag something"

kind regards -botp

thanks

···

--
Posted via http://www.ruby-forum.com/\.