Re: Newbie search replace problem
Re: Newbie search replace problem
- Subject: Re: Newbie search replace problem
- From: Bernard Azancot <email@hidden>
- Date: Sat, 11 Nov 2006 11:54:09 +0100
Quick and neat !
Thanks Michael.
Le 11 nov. 06 à 10:30, Michael Ghilissen <email@hidden> wrote:
Bonjour Bernard,
Nice !
Here is one way with regular expressions.
Note that {2,} allows for 2 or more occurrences 'new line'. You can
adapt to your specific need, or simply use (\\n\\n). Also note that
you may have to try with '\\p' or '\\r' depending on how the new
line is coded in the original text.
set theText to " aaa
aaa
aaa
b
"
tell application "TextCommands"
set theNewtext to theText as Unicode text
set the theNewtext to (search theNewtext for "(\\n){2,}" replacing
with "\\n" with regex)
end tell
theNewtext
HTH,
Michael
On Nov 11, 2006, at 3:40 AM, Bernard Azancot wrote:
I have written a simple cleaning search replace TextEdit script,
using the excellent TextCommands osax.
I would like to add a double CR, by a simple one, replacement, to
this script.
Any suggestion will be appreciated.
Thx in advance.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden