On Dec 29, 2010, at 11:44 PM, I wrote: > There is another problem. Find All '^(.|\n)', 'Es', '-am' will select two or more consecutive '^\n' (empty paragraphs) as a single selection. Probably you could solve this problem by calculating the length of selections but that would make the macro complicated. It turned out not to be so difficult, a simple math problem, although the code below may look *really* complicated ;-))) I have a vague memory that I did something similar in a NW Classic macro. And Nobumi's excitement at the performance of '$textObject.findAll' reminded me of a past discussion about NW Classic's performance in regex searches. Someone complained about it in comparison with that of BBEdit (OS9 app in those days). I did not contributed to that thread because I did not understand it well in those days. But, now I can say with a certain amount of sureness: Nisus Writer's find all may *look* slow because of the text engine's necessity of updating all selections -- which may take a rather long time -- after its regex engine's having found all occurrences in *no* time -- so to say. Kino -- $doc = Document.active Find All in Selection '^\p{Any}', 'E', '-am' # \p{Any} = (?:.|\n) $sels = $doc.textSelections Select Start # deselect selections for better performance $paraStartLocations = Array.new foreach $sel in $sels if $sel.length > 1 while $sel.location < $sel.bound $paraStartLocations.appendValue $sel.location $sel.location += 1 $sel.length -= 1 end else $paraStartLocations.appendValue $sel.location end end $tab = Cast to String "\t" foreach $i, $start in reversed $paraStartLocations $doc.text.insertAtIndex $start, $tab $doc.text.insertAtIndex $start, $i + 1 end