Re: Replace text of any characters between parentheses with a space
Posted: Sat Jun 12, 2021 9:28 pm
<Pauses...> did you try running it? Hee hee.
Questions and answers about the LiveCode platform.
https://forums.livecode.com/
<Pauses...> did you try running it? Hee hee.
In the original list post the goal was to remove everything between parentheses as well as the parentheses themselves, and replace the whole thing with a single space.richmond62 wrote: Sat Jun 12, 2021 9:26 pmOK: pause for 'evil' Richmond question:Replace text of any characters between parentheses with a space
Is that to be interpreted that EACH character between parentheses MUST be REPLACED with a SPACE?
(= as many SPACES as their are characters between parentheses.)
Or
that ALL characters between parentheses MUST be REPLACED with a SPACE?
(=1 SPACE regardless of length of string between parentheses.)
Please keep us posted when it launches.richmond62 wrote: Sat Jun 12, 2021 9:32 pm Currently up to my eyeballs in writing a set of rules for a sequence of 18 inter-related
abstract table games that I am in the middle of negotiating a contract about with a
games manufacturing company.
Hey man, I was only kidding around, sorry if I offended you somehow, but I never meant for you to quit the thread
Code: Select all
filter yourText without "(" & "*" & ")" Hi Craig - it kinda works... if you have a line that starts and ends with a parenthesis, it will remove that line. But it does not remove this from part of a line... The dictionary definition of filter suggests you can't filter chars, only lines from a text container:dunbarx wrote: Mon Jun 21, 2021 9:23 pm Mentioned this earlier. Still wondering why this does not work:I have used the "filter" command here and there for ages, but seem to have forgotten how it works.Code: Select all
filter yourText without "(" & "*" & ")"
Craig
Code: Select all
filter [{lines | items | keys | elements} of] <filterSource>... If you want to stick with filter, i guess you could replace "(" with CR & "(" and ")" with ")" & CR and then run filter, but that seems like a waste of effort... I mean this works, but you'll need at least 2 extra lines:jacque wrote: Sat Jun 12, 2021 9:00 pmCode: Select all
put replacetext(fld 1,"\(.*?\)",space) into tNewText
Code: Select all
replace "(" with CR & "(" in field 1
replace ")" with ")" & CR in field 1
filter field 1 without "(" & "*" & ")"Code: Select all
on mouseup
get fld "x"
replace "(" with "|" & CR & "(" in it
replace ")" with ")" & CR in it
filter it without "(" & "*" & ")"
replace "|" & return with "" in it
put it into fld "x"
end mouseup