Page 1 of 1

Remove irregular text between delimiters leaving some text.

Posted: Thu Sep 28, 2006 10:41 pm
by RTenebruso
I am trying (without success) to delete all text other than the tildes ~ after LastName and up to ZZEND

So

FirstName~LastName~Japanese~Jap-X~5~No Body~S1~C1~COMMENT~Barghout~Fullname~ZZEND

Would be rewritten as

FirstName~LastName~Japanese~~~~~~~~~ZZEND

FirstName and LastName are all different and of different length.

I have have a bunch of these to do.

Thank you for creating AFR (it has saved me hundreds of hours) and for any help you extend on this question.

Posted: Fri Sep 29, 2006 9:16 am
by Abacre
Go to main menu - Action - Options - Batch Replace
uncheck "Modifier S"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
(.+)~(.+)~Japanese~.+~.+~.+~.+~.+~.+~.+~.+~ZZEND

Replace with:
$1~$2~Japanese~~~~~~~~~ZZEND

Explanations:
.+ means any non empty text.
with () with put found text into $1, then into $2. We use it to store
first name and last name.

Should also Japanese be variable text?
Then you should use:

Search for:
(.+)~(.+)~(.+)~.+~.+~.+~.+~.+~.+~.+~.+~ZZEND

Replace with:
$1~$2~$3~~~~~~~~~ZZEND

That's all I verified it works perfectly.

Thank you.

Posted: Sat Sep 30, 2006 5:38 pm
by RTenebruso
Thank so much. It does work perfectly. It is elegant. Thank you for the explaination, too. AFR is so powerful and it is enjoyable to learn how to take advantage of some of what you have built into it.

Ray