![]() |
String replace
I have a string by "This is apples, it costs me &xyz and I bought them at &abc"
I need to get the folowing output "This is apples, it costs me {xyz} and I bought them at {abc}" Basically I need to replace &word with {word} Thanks Sri |
Re: String replace
Words beginning with & needs to be replaced with {} around them. Please help
|
Re: String replace
Code:
$string =~ s!&(\S+)!{$1}!g; ## $string contains the string |
Re: String replace
Dear friend,
You can use the following way also. Code:
|
Re: String replace
You can also use the following script.
$str=~s/&(\w+)/{$1}/g print $str |
Re: String replace
See the following code. It will match & followed by n number of
numbers/characters. Code:
$val =~ s/&(.*) /{$1}/g; |
Re: String replace
Quote:
Code:
$val =~ s/&(.*)/{$1}/g;sorry, I think while copy and pasting time the space is added. |
Re: String replace
hi friend,
pls try to do it. its working well. $str =~ s/&(\w+)/{$1}/gs; |
| All times are GMT +5.5. The time now is 08:18. |