<Pauses...> did you try running it? Hee hee.
Replace text of any characters between parentheses with a space
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Re: Replace text of any characters between parentheses with a space
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Replace text of any characters between parentheses with a space
"Not tonight, Josephine."
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.
- -
I wonder if anyone LIKES lawyers?
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.
- -
I wonder if anyone LIKES lawyers?
-
- VIP Livecode Opensource Backer
- Posts: 7238
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Replace text of any characters between parentheses with a space
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.)
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
-
- Livecode Opensource Backer
- Posts: 9388
- Joined: Fri Feb 19, 2010 10:17 am
- Location: Bulgaria
Re: Replace text of any characters between parentheses with a space
Thanks for the clarification.
-
- VIP Livecode Opensource Backer
- Posts: 9842
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Replace text of any characters between parentheses with a space
Please keep us posted when it launches.richmond62 wrote: ↑Sat Jun 12, 2021 9:32 pmCurrently 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.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Replace text of any characters between parentheses with a space
This is pretty late in coming, I had originally sent it as a pm but just found out it was never opened.
Again, my humblest apologies.
Hey man, I was only kidding around, sorry if I offended you somehow, but I never meant for you to quit the thread
Again, my humblest apologies.
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Replace text of any characters between parentheses with a space
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.
Craig
Code: Select all
filter yourText without "(" & "*" & ")"
Craig
Re: Replace text of any characters between parentheses with a space
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 pmMentioned 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 "(" & "*" & ")"
-
- VIP Livecode Opensource Backer
- Posts: 9670
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Replace text of any characters between parentheses with a space
Stam.
Thanks for that. Always read the dictionary. Always read the dictionary...
I went over other stacks where I had used "filter", and found that I was never going down to the character level.
Glad that I at least had the right idea. I find filter more accessible than any of the regex-based gadgets, because I can "see" wildcards more easily.
The CR kludge is, for me, actually a nice one. I do this sort of manhandling of a body of text now and then, and see it as perfectly legit: re-format text to comply with the limitations of a command or function, run it, and restore.. In this kludge, restoring means doing something like inserting a little-used character, like "|", and:
This restores the original text as written. There are better choices for the special character, perhaps numToChar(240)
Craig
Thanks for that. Always read the dictionary. Always read the dictionary...
I went over other stacks where I had used "filter", and found that I was never going down to the character level.
Glad that I at least had the right idea. I find filter more accessible than any of the regex-based gadgets, because I can "see" wildcards more easily.
The CR kludge is, for me, actually a nice one. I do this sort of manhandling of a body of text now and then, and see it as perfectly legit: re-format text to comply with the limitations of a command or function, run it, and restore.. In this kludge, restoring means doing something like inserting a little-used character, like "|", and:
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
Craig