Page 1 of 1
Finding Text between multiple lines and within Desired Text
Posted: Wed Sep 10, 2008 2:54 pm
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
Posted: Wed Sep 10, 2008 4:52 pm
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.
Posted: Thu Jan 08, 2009 8:18 am
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.
Posted: Thu Jan 08, 2009 1:39 pm
by ben_josephs
Please describe precisely what you what to find and what you want to do with it.
Posted: Fri Jan 09, 2009 1:34 am
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
that means I want to replace the
select statement with
nothing i.e all text between
'CURSOR A IS' and
';'[/i]
Thank you Ben.
Posted: Fri Jan 09, 2009 8:16 am
by ben_josephs
Find what: SELECT[^;]*
Replace with: [nothing]
[X] Regular expression
Does TextPad 5.3 regex match text over multiple lines?
Posted: Wed Aug 19, 2009 2:13 am
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?
Re: Does TextPad 5.3 regex match text over multiple lines?
Posted: Wed Aug 19, 2009 4:49 am
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