Regex newline

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
Jan Paul

Regex newline

Post by Jan Paul »

Hi,

Can anybody help me wit a RegEx problem I cannot get fixed.

I what to unwrap several lines.
All the lines beginning with a lowercase character should not be on various lines, but one single line.

ie:
This is
a test
for this RegEx.
This
too.

Must become:
This is a test for this RegEx.
This too.

For now I have found a way to get all lowercase: \n^[[:lower:]].
But what must I place in the replace with field? I have tried \1, but then \1 is filled into the text directly (I have regular expressins tagged).

Could someone help me here?

The above problem fixes only one problem, becuase I have still the problem to resolve about the tokens and upper characters in a textfile that not get corrected this way.

I you have any RegEx way to get text files with a fixed length into a "normal" unwrapped file I would like to know! This would help me a lot.

Thanks, JP
Andreas

Re: Regex newline

Post by Andreas »

replace
\n\([[:lower:]]\)
by
\1

You have to tell what you want to remember by putting it between \(\)
or, when using POSIX Syntax, between ().
Jan Paul de Frankrijker

Re: Regex newline

Post by Jan Paul de Frankrijker »

Hi Andreas,

Thanks, this helped!

Is there somebody who can help me with a good unwrapping method though?

Thanks, JP
Roy Beatty

Re: Regex newline

Post by Roy Beatty »

Find...: \.\n<br>
Replace: &\n

These expressions add a blank line at the end of each sentence. Now select all and hit ALT+CTRL+J. Remove blank lines if you need to.

Hope this helps,

Roy
Roy Beatty

Re: Regex newline

Post by Roy Beatty »

Oops, I meant SHIFT+CTRL+J
Post Reply