removing anything inside <> brackets in Numbers
I have a numbers DB I exported from PHPMyAdmin and need to remove anything inside <> brackets throughout - is there a wildcard I can use to remove them (eg <*>)?
iMac Line (2012 and Later)
I have a numbers DB I exported from PHPMyAdmin and need to remove anything inside <> brackets throughout - is there a wildcard I can use to remove them (eg <*>)?
iMac Line (2012 and Later)
Does this do what you want?
-- place the markup you want to remove between the curly brackets
-- each must be enclosed by ""
-- any. embedded " must be 'escaped' with \ as shown
set markupToRemove to {"<p><span style=\"color: #888888;\">", "</span></p>"}
set replaceWith to {}
repeat (length of markupToRemove) times
set end of replaceWith to ""
end repeat
tell front document of application "Numbers"
tell active sheet
tell (first table whose class of selection range is range)
repeat with c in cells of (get selection range)
set origVal to value of c
set value of c to my substitute(markupToRemove, replaceWith, origVal)
end repeat
end tell
end tell
end tell
on substitute(s, r, t)
set s to s as list
set r to r as list
set t to t as text
repeat with i from 1 to count s
set text item delimiters to item i of s
set t to text items of t
set text item delimiters to item i of r
set t to t as text
end repeat
return t
end substitute
If "nothing happens" make sure Script Editor is listed and checked at System Preferences > Security & Privacy > Privacy > Accessibility.
If you have other markup you need to remove include it in the markupToRemove AppleScript list as noted in the script.
SG
When you say "remove" to you mean you want to end up with empty <> brackets.
Or are you seeking to extract what is between the <>?
And one other question: do <> occur only once per row of text?
SG
I want the <> removed and anything inside them.
eg:
<p><span style="color: #888888;">Dear Members:</span></p>
<p><span style="color: #888888;"> </span></p>
<p><span style="color: #888888;">text in here to remain
</span></p>
<p><span style="color: #888888;"> </span></p>
I need it to be just :
Dear Members:
text in here to remain
I was thinking of something like this. But it isn't going to work where you have multiple <>.
Will try some other things. May need a script.
SG
thanks so much, It did what I needed!
removing anything inside <> brackets in Numbers