regular expression problem

P

Pokkai Dokkai

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 ?
 
P

Peña, Botp

RnJvbTogYmFkX2dvb2RfbGlvbkB5YWhvby5jb20gW21haWx0bzpiYWRfZ29vZF9saW9uQHlhaG9v
LmNvbV0gDQojIHN0cmluZz0ic29tZXRoaW5nIDxhIGE+IHNvbWV0aGlnIDxhIGE+IHNvbWV0aGlu
ZyINCiMgbm93IGkgd2FudCB0byBjaGFuZ2UgLzxhLiphPi8gdG8gInRhZyINCiMgaSB3YW50IHJl
c3VsdCBsaWtlIHRoaXMNCiMgc3RyaW5nPSJzb21ldGhpbmcgdGFnIHNvbWV0aGlnIHRhZyBzb21l
dGhpbmciDQoNCjowMDg6MD4gc3RyaW5nPSJzb21ldGhpbmcgPGEgYT4gc29tZXRoaWcgPGEgYT4g
c29tZXRoaW5nIg0KPT4gInNvbWV0aGluZyA8YSBhPiBzb21ldGhpZyA8YSBhPiBzb21ldGhpbmci
DQo6MDA5OjA+IHN0cmluZy5nc3ViKC88YS4qP2E+LywndGFnJykNCj0+ICJzb21ldGhpbmcgdGFn
IHNvbWV0aGlnIHRhZyBzb21ldGhpbmciDQoNCmtpbmQgcmVnYXJkcyAtYm90cA0K
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,666
Latest member
selsetu

Latest Threads

Top