Trying to change text strings using perl script.
source text|replaced text.
but am getting results like these:
Obviously, this is occurring because the script is looking at each word and replacing it, even when it is part of a phrase or part of a replacement.
ie:
'Gretna' is to be replaced in its own right and is picked up in 'Gretna Green'; being replaced before 'Green' is seen.
'Dumfries' is replaced by 'Dumfries and Galloway' but the 'Dumfries' is being picked up again and replaced for a second time.
I need to somehow tell the script only to replace the whole phrase.
I've tried using the following but it doesn't work
Can anyone tell me the correct code?
Thanks.
source text|replaced text.
Gretna|Dumfries and Galloway
Gretna Green|Dumfries and Galloway
Dumfries|Dumfries and Galloway
but am getting results like these:
Dumfries and Galloway
Dumfries and Galloway Green
Dumfries and Dumfries And Galloway
Obviously, this is occurring because the script is looking at each word and replacing it, even when it is part of a phrase or part of a replacement.
ie:
'Gretna' is to be replaced in its own right and is picked up in 'Gretna Green'; being replaced before 'Green' is seen.
'Dumfries' is replaced by 'Dumfries and Galloway' but the 'Dumfries' is being picked up again and replaced for a second time.
I need to somehow tell the script only to replace the whole phrase.
I've tried using the following but it doesn't work
"Gretna"|"Dumfries and Galloway"
"Gretna Green"|"Dumfries and Galloway"
"Dumfries"|"Dumfries and Galloway"
["Gretna"]|["Dumfries and Galloway"]
["Gretna Green"]|["Dumfries and Galloway"]
["Dumfries"]|["Dumfries and Galloway"]
Can anyone tell me the correct code?
Thanks.