For example,
$thisMessage contains:
<...>
<request attribs="true" text="this is a message" ...>text here too</request>
</...>
The desired output should be,
<...>
<request attribs="true" msg="this is a message" ...>text here too</request>
</...>
The "text" enclosed within '<' and '>' must be replaced and the text not within '<' '>' should not be touched.
The regex i wrote goes likes this,
$thisMessage =~ s/(<[^>]*)(text)([^<]*>)/$1msg$3/gi;
This works but, is there a better way of doing this?
-- Edit -- Is it possible to eliminate $1 and $3 from the replace part?