You are here: PSPad forum > English discussion forum > Multi-Line Search Add-On

Multi-Line Search Add-On

Goto Page: PreviousFirst...5 6 7 8 9 10 11 12 13 14 15 ...LastNext

#91 Re: Multi-Line Search Add-On

Posted by: vbr | Date: 2008-07-11 14:06 | IP: IP Logged

Lolo:
Thanks vbr for this confirmation.
I hope you will be able to correct this small bug.
In any case, I really love PhReplace!
Thanks and have a nice day.

Hi Lolo, sorry for the misunderstanding, I may have caused with my reply. In any case I am not the author of phReplace. (I just use it quite regularly and sometimes also try to answer some questions regarding the usage, if I'm able to.). I think Paul aka phdesigner will have a look at this problem.

Edit:
I just found out, that single replace maybe fails at [ or ]; although the RE mode is unchecked, it may be somehow there.
Moreover trying to replace e.g. {2} in non RE mode seems to cause system some kind of error.
Using regular expression and escaping those metacharacters, i.e. \[ \] etc. works fine, but it's rather ineffective, if one simply copies a text to be replaced...
Maybe this could help a bit with tracing the error source...

Edited 1 time(s). Last edit at 2008-07-11 14:28 by vbr.

Options: Reply | Quote | Up ^


#92 Re: Multi-Line Search Add-On

Posted by: Lolo | Date: 2008-07-16 09:36 | IP: IP Logged

Hi vbr,

Sorry for the misunderstanding winking smiley
I have contacted the author of PhReplace.
Now let's hope he will be able to make a patch.

By the way, thanks for your investigation on this problem.

Have a nice day.

Options: Reply | Quote | Up ^


#93 Re: Multi-Line Search Add-On

Posted by: phdesigner | Date: 2008-07-23 09:47 | IP: IP Logged

Hi All,

Please note version 1.4.3 has been released which fixes this issue.

Regards.

Options: Reply | Quote | Up ^


#94 Re: Multi-Line Search Add-On

Posted by: tone007 | Date: 2008-07-29 09:03 | IP: IP Logged

I really like the idea as this is something I was struggling with as I have huge files to change and have to do the change to 5 lines 5000 times.

So I tried the "replace all" feature but it just goes into a hang mode for quite some time.

So I opted for the no brainer option of clicking on "replace" 300 odd times but after replacing it then gives me an error message

"Run-time error: 6: overflow"

Can you please help.

I had tried to solve this issue before coming across this add on by doing a find and then copy paste...I tried to do the copy paste using a macro...but since I dont know much about how to write scripts in the macro i was pretty much stuck....can you point me in a direction where I can do tutorials and learn more about writing scripts in macros.

You can email me at tone007@rediffmail.com

Appreciate all your help and support.

thanks in advance
Tony

Options: Reply | Quote | Up ^


#95 Re: Multi-Line Search Add-On

Posted by: vbr | Date: 2008-07-29 10:07 | IP: IP Logged

tone007:
I really like the idea as this is something I was struggling with as I have huge files to change and have to do the change to 5 lines 5000 times.

Hi, on huge files the replace might take some time, could you maybe post a sample data as well as the replacement?

I tried a dummy text

Quote:
line 01 line 01 line 01 line 01 line 01 line 01 line 01 line 01 line 01 line 01
line 02 line 02 line 02 line 02 line 02 line 02 line 02 line 02 line 02 line 02
line 03 line 03 line 03 line 03 line 03 line 03 line 03 line 03 line 03 line 03
line 04 line 04 line 04 line 04 line 04 line 04 line 04 line 04 line 04 line 04
line 05 line 05 line 05 line 05 line 05 line 05 line 05 line 05 line 05 line 05
line 06 line 06 line 06 line 06 line 06 line 06 line 06 line 06 line 06 line 06
line 07 line 07 line 07 line 07 line 07 line 07 line 07 line 07 line 07 line 07
line 08 line 08 line 08 line 08 line 08 line 08 line 08 line 08 line 08 line 08
line 09 line 09 line 09 line 09 line 09 line 09 line 09 line 09 line 09 line 09
line xx line xx line xx line xx line xx line xx line xx line xx line xx line xx
... ca. 45000 lines

and the replacing

Quote:
line 02 line 02 line 02 line 02 line 02 line 02 line 02 line 02 line 02 line 02
line 03 line 03 line 03 line 03 line 03 line 03 line 03 line 03 line 03 line 03
line 04 line 04 line 04 line 04 line 04 line 04 line 04 line 04 line 04 line 04
line 05 line 05 line 05 line 05 line 05 line 05 line 05 line 05 line 05 line 05
line 06 line 06 line 06 line 06 line 06 line 06 line 06 line 06 line 06 line 06

to

Quote:
TEXT 02 line 02 line 02 line 02 line 02 line 02 line 02 line 02 line 02 line 02
TEXT 03 line 03 line 03 line 03 line 03 line 03 line 03 line 03 line 03 line 03
TEXT 04 line 04 line 04 line 04 line 04 line 04 line 04 line 04 line 04 line 04
TEXT 05 line 05 line 05 line 05 line 05 line 05 line 05 line 05 line 05 line 05
TEXT 06 line 06 line 06 line 06 line 06 line 06 line 06 line 06 line 06 line 06

took approx. 7 minutes using phReplace 1.4.3

Maybe there other ways to achive this too.
The documantation to PSPad scripting is in the helpfile: Customize PSPad: Script

Macros are somewhat limited, but easier to use:
Help :: Working with PSPad: Macro

Edited 2 time(s). Last edit at 2008-07-29 10:10 by vbr.

Options: Reply | Quote | Up ^


#96 Re: Multi-Line Search Add-On

Posted by: nexor | Date: 2008-07-29 12:16 | IP: IP Logged

simple task: remove all empty lines.

regexp matching an empty line is: ^\s*$

the phReplace is finding all lines as matching. it seems that it has some problems with beggining of line as
^\s
matches *every* white char in document

--
--
-o((: w-files.pl smiling smiley)o-

Options: Reply | Quote | Up ^


#97 Re: Multi-Line Search Add-On

Posted by: tone007 | Date: 2008-08-01 08:16 | IP: IP Logged

Hey thanks for this tip on the help file. I'll go through this. Here is an example of the file I have:

COMPDAT
W1 18 1 1 1 OPEN 1*
4.452451E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.214233E+001 /
W1 19 1 1 1 OPEN 1*
4.532991E-003 2.438400E-001 5.061100E-001 0.000000E+000 1* Z 4.827184E+001 /
W1 20 1 1 1 OPEN 1*
4.524853E-003 2.438400E-001 5.033911E-001 0.000000E+000 1* Z 4.724831E+001 /
W1 21 1 1 1 OPEN 1*
4.467094E-003 2.438400E-001 5.036242E-001 0.000000E+000 1* Z 5.117605E+001 /
W1 22 1 1 1 OPEN 1*
4.481863E-003 2.438400E-001 5.053080E-001 0.000000E+000 1* Z 5.118749E+001 /
W1 23 1 1 1 OPEN 1*
4.469954E-003 2.438400E-001 5.039735E-001 0.000000E+000 1* Z 5.119254E+001 /
W1 24 1 1 1 OPEN 1*
4.466344E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.116889E+001 /
W1 25 1 1 1 OPEN 1*
4.465689E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.121421E+001 /
W1 26 1 1 1 OPEN 1*
4.469954E-003 2.438400E-001 5.039735E-001 0.000000E+000 1* Z 5.119254E+001 /
W1 27 1 1 1 OPEN 1*
4.481863E-003 2.438400E-001 5.053080E-001 0.000000E+000 1* Z 5.118749E+001 /
W1 28 1 1 1 OPEN 1*
4.467094E-003 2.438400E-001 5.036242E-001 0.000000E+000 1* Z 5.117605E+001 /
W1 29 1 1 1 OPEN 1*
4.524853E-003 2.438400E-001 5.033911E-001 0.000000E+000 1* Z 4.724831E+001 /
W1 30 1 1 1 OPEN 1*
4.532741E-003 2.438400E-001 5.061100E-001 0.000000E+000 1* Z 4.828777E+001 /
W1 31 1 1 1 OPEN 1*
4.451635E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.220020E+001 /
W1 32 1 1 1 OPEN 1*
7.547348E+003 2.438400E-001 1.001737E+006 0.000000E+000 1* Z 1.492991E+002 /
W1 33 1 1 1 OPEN 1*
4.452451E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.214233E+001 /
W1 34 1 1 1 OPEN 1*
4.532991E-003 2.438400E-001 5.061100E-001 0.000000E+000 1* Z 4.827184E+001 /
W1 35 1 1 1 OPEN 1*
4.524853E-003 2.438400E-001 5.033911E-001 0.000000E+000 1* Z 4.724831E+001 /
W1 36 1 1 1 OPEN 1*
4.467094E-003 2.438400E-001 5.036242E-001 0.000000E+000 1* Z 5.117605E+001 /
W1 37 1 1 1 OPEN 1*
4.481863E-003 2.438400E-001 5.053080E-001 0.000000E+000 1* Z 5.118749E+001 /
W1 38 1 1 1 OPEN 1*
4.469954E-003 2.438400E-001 5.039735E-001 0.000000E+000 1* Z 5.119254E+001 /
W1 39 1 1 1 OPEN 1*
4.466344E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.116889E+001 /
W1 40 1 1 1 OPEN 1*
4.465689E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.121421E+001 /
W1 41 1 1 1 OPEN 1*
4.469954E-003 2.438400E-001 5.039735E-001 0.000000E+000 1* Z 5.119254E+001 /
W1 42 1 1 1 OPEN 1*
4.481863E-003 2.438400E-001 5.053080E-001 0.000000E+000 1* Z 5.118749E+001 /
W1 43 1 1 1 OPEN 1*
4.467094E-003 2.438400E-001 5.036242E-001 0.000000E+000 1* Z 5.117605E+001 /
W1 44 1 1 1 OPEN 1*
4.524853E-003 2.438400E-001 5.033911E-001 0.000000E+000 1* Z 4.724831E+001 /
W1 45 1 1 1 OPEN 1*
4.532741E-003 2.438400E-001 5.061100E-001 0.000000E+000 1* Z 4.828777E+001 /
W1 46 1 1 1 OPEN 1*
4.451635E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.220020E+001 /
W1 17 1 1 1 OPEN 1*
7.547348E+003 2.438400E-001 1.001737E+006 0.000000E+000 1* Z 1.492991E+002 /
/

WCONPROD
W1 STOP 1* 1* 1* 1* 1* 1* /
/

-- Set no of restart files, and set to give results viewer info only
RPTSCHED
FIP
/
RPTRST
BASIC=2 NORST=2 POT
/

DRSDT

/

TUNING
4.16667e-006 0.000335648 1.0E-9 1.0E-9 1.2 /
/
8* 1504.04 3008.09 /

TSTEP
1*4.1666667e-006
/
------------------------------------------------------------
-- Period start time: 0
------------------------------------------------------------

COMPDAT
W1 18 1 1 1 OPEN 1*
4.452451E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.214233E+001 /
W1 19 1 1 1 OPEN 1*
4.532991E-003 2.438400E-001 5.061100E-001 0.000000E+000 1* Z 4.827184E+001 /
W1 20 1 1 1 OPEN 1*
4.524853E-003 2.438400E-001 5.033911E-001 0.000000E+000 1* Z 4.724831E+001 /
W1 21 1 1 1 OPEN 1*
4.467094E-003 2.438400E-001 5.036242E-001 0.000000E+000 1* Z 5.117605E+001 /
W1 22 1 1 1 OPEN 1*
4.481863E-003 2.438400E-001 5.053080E-001 0.000000E+000 1* Z 5.118749E+001 /
W1 23 1 1 1 OPEN 1*
4.469954E-003 2.438400E-001 5.039735E-001 0.000000E+000 1* Z 5.119254E+001 /
W1 24 1 1 1 OPEN 1*
4.466344E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.116889E+001 /
W1 25 1 1 1 OPEN 1*
4.465689E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.121421E+001 /
W1 26 1 1 1 OPEN 1*
4.469954E-003 2.438400E-001 5.039735E-001 0.000000E+000 1* Z 5.119254E+001 /
W1 27 1 1 1 OPEN 1*
4.481863E-003 2.438400E-001 5.053080E-001 0.000000E+000 1* Z 5.118749E+001 /
W1 28 1 1 1 OPEN 1*
4.467094E-003 2.438400E-001 5.036242E-001 0.000000E+000 1* Z 5.117605E+001 /
W1 29 1 1 1 OPEN 1*
4.524853E-003 2.438400E-001 5.033911E-001 0.000000E+000 1* Z 4.724831E+001 /
W1 30 1 1 1 OPEN 1*
4.532741E-003 2.438400E-001 5.061100E-001 0.000000E+000 1* Z 4.828777E+001 /
W1 31 1 1 1 OPEN 1*
4.451635E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.220020E+001 /
W1 32 1 1 1 OPEN 1*
7.547348E+003 2.438400E-001 1.001737E+006 0.000000E+000 1* Z 1.492991E+002 /
W1 33 1 1 1 OPEN 1*
4.452451E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.214233E+001 /
W1 34 1 1 1 OPEN 1*
4.532991E-003 2.438400E-001 5.061100E-001 0.000000E+000 1* Z 4.827184E+001 /
W1 35 1 1 1 OPEN 1*
4.524853E-003 2.438400E-001 5.033911E-001 0.000000E+000 1* Z 4.724831E+001 /
W1 36 1 1 1 OPEN 1*
4.467094E-003 2.438400E-001 5.036242E-001 0.000000E+000 1* Z 5.117605E+001 /
W1 37 1 1 1 OPEN 1*
4.481863E-003 2.438400E-001 5.053080E-001 0.000000E+000 1* Z 5.118749E+001 /
W1 38 1 1 1 OPEN 1*
4.469954E-003 2.438400E-001 5.039735E-001 0.000000E+000 1* Z 5.119254E+001 /
W1 39 1 1 1 OPEN 1*
4.466344E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.116889E+001 /
W1 40 1 1 1 OPEN 1*
4.465689E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.121421E+001 /
W1 41 1 1 1 OPEN 1*
4.469954E-003 2.438400E-001 5.039735E-001 0.000000E+000 1* Z 5.119254E+001 /
W1 42 1 1 1 OPEN 1*
4.481863E-003 2.438400E-001 5.053080E-001 0.000000E+000 1* Z 5.118749E+001 /
W1 43 1 1 1 OPEN 1*
4.467094E-003 2.438400E-001 5.036242E-001 0.000000E+000 1* Z 5.117605E+001 /
W1 44 1 1 1 OPEN 1*
4.524853E-003 2.438400E-001 5.033911E-001 0.000000E+000 1* Z 4.724831E+001 /
W1 45 1 1 1 OPEN 1*
4.532741E-003 2.438400E-001 5.061100E-001 0.000000E+000 1* Z 4.828777E+001 /
W1 46 1 1 1 OPEN 1*
4.451635E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.220020E+001 /
W1 17 1 1 1 OPEN 1*
7.547348E+003 2.438400E-001 1.001737E+006 0.000000E+000 1* Z 1.492991E+002 /
/

c.a. 3000 times

+++++++++++++++++++++++++++++++++++++++++++++++++++++++

And I need to change this to:

COMPDAT
W1 18 1 1 1 OPEN 1*
4.452451E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.214233E+001 /

/

WCONPROD
W1 STOP 1* 1* 1* 1* 1* 1* /
/

-- Set no of restart files, and set to give results viewer info only
RPTSCHED
FIP
/
RPTRST
BASIC=2 NORST=2 POT
/

DRSDT

/

TUNING
4.16667e-006 0.000335648 1.0E-9 1.0E-9 1.2 /
/
8* 1504.04 3008.09 /

TSTEP
1*4.1666667e-006
/
------------------------------------------------------------
-- Period start time: 0
------------------------------------------------------------

COMPDAT
W1 18 1 1 1 OPEN 1*
4.452451E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.214233E+001 /

/

Appreciate any response on how to solve this.

cheers
tone

Options: Reply | Quote | Up ^


#98 Re: Multi-Line Search Add-On

Posted by: Ondrej Beran | Date: 2008-08-02 14:08 | IP: IP Logged

tone007:
Appreciate any response on how to solve this.

FYI: I tried to design a regex for backward search to replace your original text in PSPad (4.5.4.2325), but with no success sad smiley

OTOH, I can do it using MultiEdit and/or Eclipse.

Ondrej

Options: Reply | Quote | Up ^


#99 Re: Multi-Line Search Add-On

Posted by: vbr | Date: 2008-08-02 19:34 | IP: IP Logged

tone007:
Hey thanks for this tip on the help file. I'll go through this. Here is an example of the file I have:

COMPDAT
W1 18 1 1 1 OPEN 1*
4.452451E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.214233E+001 /
W1 19 1 1 1 OPEN 1*
4.532991E-003 2.438400E-001 5.061100E-001 0.000000E+000 1* Z 4.827184E+001 /
...
...
COMPDAT
W1 18 1 1 1 OPEN 1*
4.452451E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.214233E+001 /
...
/

c.a. 3000 times
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
And I need to change this to:
...
COMPDAT
W1 18 1 1 1 OPEN 1*
4.452451E-003 2.438400E-001 5.035279E-001 0.000000E+000 1* Z 5.214233E+001 /

/

WCONPROD
W1 STOP 1* 1* 1* 1* 1* 1* /
/

...
Appreciate any response on how to solve this.

cheers
tone

Hi, I'm afraid, I couldn't find any viable solution for this task using PhHReplace or PSPad in general; I guess some specialised software might be more suitable for tasks like this.
Just to make sure I underestood well - you want to reduce some kind of data section between
"COMPDAT"
and
"/" - single slash on the line-beginning
so that only the first two lines from this section are retained - is it a correct interpretation?
(I'm not quite sure regarding the repetition are there ca. 3000 "data-lines" or that number of COMPDAT blocks ?)
Anyway, you may check the "List" and "list not matching" options of the search dialog, but I'm not sure, if it is possible to specify excluding regex for all not wanted lines ...
Sorry for not beeing able to help more effectively and specifically...
vbr

Edited 1 time(s). Last edit at 2008-08-02 19:38 by vbr.

Options: Reply | Quote | Up ^


#100 Re: Multi-Line Search Add-On

Posted by: ellocco | Date: 2008-09-09 09:27 | IP: IP Logged

Hello,

I need some examples, the site:
www.regular-expressions.info

is fine, but I still don't know how to add new lines
(\n or \u000D) with the replace feature.

e.g. Search Regular expression:
(aaa)
Replace Regular expression
\n$1\n
or
\u000D$1\u000D
or
\\u000D$1\\u000D

is not working.
So what is the trick?

Regards

ellocco

Options: Reply | Quote | Up ^


Goto Page: PreviousFirst...5 6 7 8 9 10 11 12 13 14 15 ...LastNext





Editor PSPad - freeware editor, © 2001 - 2019 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR