Find and Replace from Lists
Hi Everyone
I am new to regex so don't know if what I am trying to do is possible and at the moment I have limited skills but I am learning.
I would like to convert US books to UK versions by searching and replacing US words and phrases to UK. e.g 'color' to 'colour' and 'cell phone' to' mobile phone'.
I would like to do this using two lists so I can add to the lists as I find new words or phrases to convert.
I think the function would be something like:
START
n=0
FETCH LIST#1/STRING#1(color)
FETCH LIST#2/STRING#1(colour)
FIND LIST#1/STRING#1 in the text
IF MATCH FOUND
REPLACE LIST#1/STRING#1 with LIST#2/STRING#1
n+1
GO TO SEARCHn
SEARCHn
FETCH LIST#1/STRING#2
FETCH LIST#2/STRING#2
FIND LIST#1/STRING#2 in the text
IF MATCH FOUND
REPLACE LIST#1/STRING#2 with LIST#2/STRING#2
n+1
GO TO SEARCHn
And so on until end of list.
Is this possible? Has this already been done in some way?
I would be very grateful if someone could point me in the right direction.
Thanks - moldy
|