Hello Mike,

On Wednesday, February 19, 2003 at 5:23 PM, resistance was high, but
Mike Dillinger [MD] made current:

MD> I'm trying to make a regex template to get rid of duplicate newlines.

Can you be more specific?  Perhaps an example would help. I don't
really understand where these new lines exist, and how many are you
trying to remove?  What is your final goal?  Maybe there is an easier or
at least preexisting solution.

MD> Can anyone help me out?  I may not even be close.  Right now, it's not
MD> doing anything.

You need to have capturing subpatterns for the text before and after
the region you want to remove.  In your example, adding "(.*?)"
(without quotes) and anchors (eg: ^ or $) before and after your pattern
would do the trick.  Of course, you haven't really specified what part
of the duplication you're trying to remove.  Right now, since you have
\n{2}, my suggestion above runs the risk of only deleting a single
blank line between paragraphs.  Is that what you want, or do you want
to delete all but one blank line between paragraphs?

Of course, everything I've said to this point will only work for *one*
deletion.  If you want to remove multiple instances, you'd need to
make your template quite long (each section needs it's own
subpattern), or use a recursive template scheme.

If I understand your objective, your best bet is to modify my wrap2
recursive template (see below for URL).  If you remove the %WRAPPED
from my engine, it will isolate paragraphs and allow you to control
how they are separated.

The URL is:
<http://www.silverstones.com/thebat/Library.html#rewrap>
Though, while testing, you'd probably want to use a driver template
more like Allie's:
<http://www.silverstones.com/thebat/Library.html#rewrap+clipboard+content>

I understand these recursive templates may look complex, so if you
give us some more info, I'd be happy to help you modify them
appropriately.

-- 
Thanks for writing,
 Januk Aggarwal

Was August Mobius so rigid that he could only see one side of a question?




________________________________________________________
 Current version is 1.61 | "Using TBTECH" information:
http://www.silverstones.com/thebat/TBUDLInfo.html

Reply via email to