viewtopic.php?f=7&t=35951
The task was to replace a character string using the "filter" command. This command is not directly applicable at the character level, that is, one cannot, say:
Code: Select all
filter "XYZ" without "Y"
But Stam provided a clever kludge, reformatting the string of interest into lines, and filtering that. I added just a little enhancement, to restore the original text. So for example if one wanted to delete, in a body of text, every string enclosed by parens, such as "(abcd)", including the parens themselves:
Code: Select all
on mouseup
put numToChar(240) into ZZ -- a char unlikely to be found in any text
get fld 1
replace "(" with ZZ & CR & "(" in it
replace ")" with ")" & CR in it
filter it without "(" & "*" & ")"
replace ZZ & return with "" in it
put it into fld 1
end mouseup
Craig