Finding Text between multiple lines and within Desired Text

General questions about using TextPad

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

Post Reply
Eleung
Posts: 1
Joined: Wed Sep 10, 2008 2:40 pm

Finding Text between multiple lines and within Desired Text

Post by Eleung »

I apologize if this is somewhere within the 500 pages of the Forum, but..

I have this sample text:
@HEADER
From :
Dr. AM
Editor-in-Chief
Email: am@abc.org

@HEADER-END
**end sample text**

I want to Find all text between @HEADER and @HEADER-END, inclusive.
I tried:
@HEADER\n[.*\n]*@HEADER-END$

I am using Textpad, but it doesn't seem to translate over multiple lines.
The text in between, of course, can be an unspecified number of lines.

Thank you in advance
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Yes, this has been discussed many times before.

TextPad's aged regular expression engine is incapable of matching text containing an arbitrary number of newlines.

If your input is not too long, you could change the newlines to something else, do your stuff, then change them back.

Or you could record a macro that extends the selection from the beginning of the wanted text to its end, and do your stuff on the selected text.

Alternatively, you could try WildEdit (http://www.textpad.com/products/wildedit/), which uses a far more powerful regular expression engine.
aimy
Posts: 53
Joined: Mon Nov 01, 2004 4:02 am

Post by aimy »

ben_josephs wrote:Yes, this has been discussed many times before.

TextPad's aged regular expression engine is incapable of matching text containing an arbitrary number of newlines.

If your input is not too long, you could change the newlines to something else, do your stuff, then change them back.

Or you could record a macro that extends the selection from the beginning of the wanted text to its end, and do your stuff on the selected text.

Alternatively, you could try WildEdit (http://www.textpad.com/products/wildedit/), which uses a far more powerful regular expression engine.
So how do I achieve this using WildEdit?

Thank you.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Please describe precisely what you what to find and what you want to do with it.
aimy
Posts: 53
Joined: Mon Nov 01, 2004 4:02 am

Post by aimy »

ben_josephs wrote:Please describe precisely what you what to find and what you want to do with it.
I want to replace this...

Code: Select all

CURSOR A IS
SELECT
ORDER_NUMBER, STORE_NUM, CV, ACTIVITY_DATE, ACTIVITY_TYPE, SERVICE_NUMBER, ACTIVITY_DESC, 
ACTIVITY_STATUS, ACTIVITY_ID, ACTIVITY_GROUP, ACTIVITY_COMMENT
FROM ICARE_ICC_ACTIVITY_EXT;
with

Code: Select all

CURSOR A IS
nothing;
that means I want to replace the select statement with nothing i.e all text between 'CURSOR A IS' and ';'[/i]

Thank you Ben.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Find what: SELECT[^;]*
Replace with: [nothing]

[X] Regular expression
JohnH
Posts: 6
Joined: Wed Aug 19, 2009 1:45 am

Does TextPad 5.3 regex match text over multiple lines?

Post by JohnH »

ben_josephs wrote:Yes, this has been discussed many times before.

TextPad's aged regular expression engine is incapable of matching text containing an arbitrary number of newlines.

If your input is not too long, you could change the newlines to something else, do your stuff, then change them back.

Or you could record a macro that extends the selection from the beginning of the wanted text to its end, and do your stuff on the selected text.

Alternatively, you could try WildEdit (http://www.textpad.com/products/wildedit/), which uses a far more powerful regular expression engine.
Does TextPad 5.3 fix this regex problem with matching text over multiple lines? I am still using 4.7.3 and will upgrade if it does. If not, is there a plan to modernize "TextPad's aged regular expression engine" anytime soon?
ak47wong
Posts: 703
Joined: Tue Aug 12, 2003 9:37 am
Location: Sydney, Australia

Re: Does TextPad 5.3 regex match text over multiple lines?

Post by ak47wong »

JohnH wrote:Does TextPad 5.3 fix this regex problem with matching text over multiple lines?
No, it doesn't.
JohnH wrote:If not, is there a plan to modernize "TextPad's aged regular expression engine" anytime soon?
Your guess is as good as anyone's.

Andrew
Post Reply