Reputation: 1874
I searched through a lot of "regex first match only" questions but couldn't manage to build my regex based on the results. I am not good in regex, i use the following to replace all the occurrences in the text in perl:
$xmlText =~ s/(xmlns)/$exhangeText/g;
However I just want to have the first occurrence to be changed, how can I achieve this?
Many thanks for any help Nico
Upvotes: 1
Views: 108
Reputation: 91430
Just remove the global modifier:
$xmlText =~ s/(xmlns)/$exhangeText/;
Upvotes: 5