Two non working expression (although they do work elsewhere)

Tool for Search and Replace across multiple files.
Post Reply
juergen
Posts: 4
Joined: Mon Feb 27, 2012 7:42 am

Two non working expression (although they do work elsewhere)

Post by juergen »

Hello,
I need to check for spaces and tabs at the beginning and end of paragraphs.
Those two expressions work with Notepad++ but not with TextCrawler:

tab or space at the beginning

Code: Select all

^[ \t]+
tab or space at the end

Code: Select all

[ \t]+$
Any idea somebody why those won't work?
Juergen
User avatar
Fool4UAnyway

Re: Two non working expression (although they do work elsewh

Post by Fool4UAnyway »

It's because ^and $ don't represent the same in Notepad++ and Text Crawler (V2 and above).

In Text Crawler you could use the following expressions.

Find:
\r\n[ \t]+
[ \t]+\r\n

Replace (both) by:
\r\n

This will use the newline characters to match the start and end of lines but you will have to re-place them and also change white space at the start and end of the document manually or use the expressions you tried for that.

In Text Crawler:
^= start of the document
$ = end of the document
User avatar
DigitalVolcano
Site Admin
Posts: 1729
Joined: Thu Jun 09, 2011 10:04 am

Re: Two non working expression (although they do work elsewh

Post by DigitalVolcano »

TextCrawler can use ^ and $ for the beginning and end of a line if you check the 'Multi-line anchors' option
juergen
Posts: 4
Joined: Mon Feb 27, 2012 7:42 am

Re: Two non working expression (although they do work elsewh

Post by juergen »

DigitalVolcano wrote:TextCrawler can use ^ and $ for the beginning and end of a line if you check the 'Multi-line anchors' option
Thank you. That helped.
But wouldn't that be an error? The pattern does not stretch beyond a line boundary, does it?
User avatar
DigitalVolcano
Site Admin
Posts: 1729
Joined: Thu Jun 09, 2011 10:04 am

Re: Two non working expression (although they do work elsewh

Post by DigitalVolcano »

'Multi line anchors' means that the start and end anchors work on each line separately. Confusing reg-ex terminology i know!
User avatar
Fool4UAnyway

Re: Two non working expression (although they do work elsewh

Post by Fool4UAnyway »

Would something like "Scan text line by line" be a better description?

It doesn't explicitly talk about the line anchors, but the current text sure is confusing.

I never thought that would make the difference for which I still use Text Crawler 1!
Post Reply