Warning: Smarty error: problem creating directory "/usr/www/users/tsoft/hwp/templates_c//main_default_header/%%415/%%4159914376" in /usr/www/users/tsoft/hwp/smarty/Smarty.class.php on line 589

Warning: Smarty error: problem writing '/usr/www/users/tsoft/hwp/templates_c//main_default_header/%%415/%%4159914376/header.tpl.php.' in /usr/www/users/tsoft/hwp/smarty/Smarty.class.php on line 589

Warning: touch() [function.touch]: Unable to create file /usr/www/users/tsoft/hwp/templates_c//main_default_header/%%415/%%4159914376/header.tpl.php because No such file or directory in /usr/www/users/tsoft/hwp/smarty/Smarty.class.php on line 968

Warning: include(/usr/www/users/tsoft/hwp/templates_c//main_default_header/%%415/%%4159914376/header.tpl.php) [function.include]: failed to open stream: No such file or directory in /usr/www/users/tsoft/hwp/smarty/Smarty.class.php on line 686

Warning: include() [function.include]: Failed opening '/usr/www/users/tsoft/hwp/templates_c//main_default_header/%%415/%%4159914376/header.tpl.php' for inclusion (include_path='.:/usr/local/lib/php') in /usr/www/users/tsoft/hwp/smarty/Smarty.class.php on line 686
Main Page / Browse Categories / Editing/Formatting / RegEx - Remove 3 or more linebreaks
RegEx - Remove 3 or more linebreaks

A user wrote:

I hope your plans include a feature to remove repeated (multiple, 3 or more in sequence) end of paragraph characters, during a "text cleanup". Of course I need two paragraph marks, one to end the paragraph, and one to provide one line space between paragraphs. In the editing work that I do, that is the single most irritating problem that I encounter, where the author puts more than two paragraph marks.

Your wish is granted! {poof!}

The RegEx Find & Replace can handle this easily. Well, it WOULD be easy if I were better at RegEx. But I figured it out.

Set as follows:

Find:  (\x0D\x0A){3,}     [x] RegEx?
Repl: \x0D\x0A\x0D\x0A    [x] RegEx?
                          [ ] Line By Line?

Explanation:
\x0D is a carriage return, \x0A is a linefeed, expressed in hexidecimal notation, understandable by the RegEx parser.
By placing in round braces (), that groups them together so that the iterator {} can treat as a whole. 3 means "at least 3 of these", where "these" are the preceding pattern, which is treated as a whole due to the round braces. The comma after the 3 separates min/max. Here min is 3, and max is unlimited. I could have written {3,999} instead, for example. The max is optional, but the comma isn't - otherwise it would do "only 3".
We're replacing with 2 carriage-return/linefeeds.

We're turning off the line-by-line option, so that the linebreaks are visible to the RegEx (otherwise it would not see them).

I will add this to the ClipMate help, under RegEx examples.

keywords: find replace regex linebreak removal



User Comments
RegEx - Remove 3 or more linebreaks
Add Comment
There are no user comments for this topic.
Add Comment
Additional Info
General Information
Article No. 101
Created: 01:25 PM 10.31.04
Author: Chris Thornton

Attachments
No attachments.

Did this help you?
Yes No

Statistics
Yes382 (46%) Voted Yes450 (54%) Voted NoNo

Other Options
Print Article
Email Article

Related Articles
How do I enter a tab in the text field of a clip?
How do I Change the title of a clip?
How do I Change the font/color/etc., of a clip?
When I paste from ClipMate, the data isn't the same as it is when doing a straight copy/paste.
Titles - how do I make the title reflect the editing?
Powered by HelpWorks Professional