Regex and block select mode

General questions about using TextPad

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

Post Reply
Todd DeZwaan

Regex and block select mode

Post by Todd DeZwaan »

I am using the block select mode to select and remove all of the carriage returns in a block. I tried to replace them using the regex \n and keeping the replace space blank, but I get a message "Cannot find regular expression '\n'". I have the Regular expression checked in the replace window. I have also tried the join lines tool but that joins all of the lines spanned by the block, not just the selected carriage returns.

Is there a way to get the \n regex recognized in block select mode?

Todd
Carlyle Sutphen

Re: Regex and block select mode

Post by Carlyle Sutphen »

Hi, Todd.

That's not working because block mode basically only sees spaces where the block extends beyond the end of the line.

It looks like you want to join lines shorter than a certain length to it's following line.

In the case that the maximum line length you want to join to it's follower is 14, you could

find: ^(.{1,14})\n
and
replace: \1

Carlyle
Roy Beatty

Re: Regex and block select mode

Post by Roy Beatty »

Unless you're using POSIX-optioned regex, he meant to say:

find: ^\(.\{1,14\}\)\n<br>
and<br>
replace: \1
Carlyle Sutphen

Re: Regex and block select mode

Post by Carlyle Sutphen »

I forgot that I had turned on that option :-)
Post Reply