On Sep 24, 2011, at 10:03 AM, Rick Gordon wrote:
> How can I set up a grep search that will repeat looping through the document
> until all instances have been processed?
>
> For instance, say I've set up markers (« and ») around target source strings,
> and want to process thos strings to remove any characters that are not ASCII,
> numeric, space, or hyphen. Something like:
>
> FIND:
> (?<=«)(.*?)[^- A-Za-z0-9«»]+?(.*?)(?=»)
>
> CHANGE TO:
> \1\2
>
> How can I keep it looping until no more instances are found?
>
This AppleScript loop replaces two carriage returns (\r\r} to one (\r), so just
put your search and replace items in their place:
tell application "BBEdit"
activate
select text 1 of project window 1
open find window
repeat
replace "\\r\\r" using "\\r" searching in selection of project
window 1 options {search mode:grep, starting at top:false, wrap around:false,
backwards:false, case sensitive:false, match words:false, extend
selection:false}
end repeat
end tell
Tor Rafsol Løseth
--
You received this message because you are subscribed to the
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem,
please email "[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>