Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie search replace problem



Bonjour Bernard,

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:

This email sent to email@hidden

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/mailman//archives/applescript-users

This email sent to email@hidden

References: 
 >Newbie search replace problem (From: Bernard Azancot <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.