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

Multi-Line Search Add-On

Goto Page: Previous1 2 3 4 5 6 7 8 9 10 11 ...LastNext

#51 Re: Multi-Line Search Testers Needed

Posted by: bee | Date: 2007-01-31 10:51 | IP: IP Logged

Thanks for the nice plugin. I need this since the first time I found PSPad. But, why it always fail to search on the first attemp (first click on Replace button) but work on the second click. It's quite annoying! Tested on PSPad v.4.5.3 (2250).

Options: Reply | Quote | Up ^


#52 Re: Multi-Line Search Testers Needed

Posted by: bee | Date: 2007-01-31 11:14 | IP: IP Logged

I'm no expert of regular expression. But how to do this:

a;
b;
c;
d;

into:

a,b,c,d

and vice-versa, using this plugin? TIA.

Options: Reply | Quote | Up ^


#53 Re: Multi-Line Search Testers Needed

Posted by: vbr | Date: 2007-01-31 11:20 | IP: IP Logged

You don't need regexp at all for doing this.
Replace (without quotes)
";
"
with ","
(assuming, there is a linebreak after the last d;)

Edited 3 time(s). Last edit at 2007-01-31 12:00 by vbr.

Options: Reply | Quote | Up ^


#54 Re: Multi-Line Search Testers Needed

Posted by: phdesigner | Date: 2007-01-31 22:21 | IP: IP Logged

Hi Bee,

What I had tried to with the replace function was that the first time you hit replace it should just search for the next occurance, then the next time you hit replace it will replace that occurance then find the next match. Perhaps I should first check whether the currently highlighted text is what you searched for then if it is replace it. This is the way I had it working initally but that caused problems with RE. Anyway, I'll review the way it works.

Thanks for answering the RE question vbr, I'm still learning myself. You might be able to help me with something, if I search for [ ]*(?=[ ]) in PSPad's normal search it says there's an error in the search expression, however if I search for it with phReplace I find mathces but some of the matches will have 0 length. I'm not sure what to do with that. I expected this search to find a space with any trailing spaces (I know there are better ways to do this, but it's a good example for this 0 length problem)

I'm guessing PSPad first vaildates the search, I don't think vb offers any support for validating it.

Anyway, with regard to back references, I now see what your talking about. The reason it wont work is because I use RE to search for the match, but once it finds it I just replace it manually. To use back references I would have to replace it using the RE replace function, I'll look into doing this.

Options: Reply | Quote | Up ^


#55 Re: Multi-Line Search Testers Needed

Posted by: vbr | Date: 2007-02-01 09:25 | IP: IP Logged

phdesigner:
...
if I search for [ ]*(?=[ ]) in PSPad's normal search it says there's an error in the search expression, however if I search for it with phReplace I find mathces but some of the matches will have 0 length. I'm not sure what to do with that. I expected this search to find a space with any trailing spaces (I know there are better ways to do this, but it's a good example for this 0 length problem)

I'm guessing PSPad first vaildates the search, I don't think vb offers any support for validating it.

Hi, thanks for taking backreferences into account. - I think, the reason your expression don't work in PSPad's built in search is simply because it doesn't support these advanced features at all. I allready noticed this limitation -

- this is called "positive lookahead"
see my favourite ressource www.regular-expressions.info
(i noticed that your script supports also the negative lookahead, but it doesn't support the Lookbehind constructions (due to the lacking VB feature www.regular-expressions.info) - here I get a run-time error 5017 application-defined or object-defined error; but after closing a dialog with the upper right cross (not Close) other searches work ok; I think this is enough to see an error; the validator would probably complicate the code a bit)

your expression [ ]*(?=[ ]) should match zero or more spaces only if it is/they are followed by a space.

the lookahead expression (?=[ ]) isn't part of the match it is only used as a condition if the preceeding part should match. As [ ]* can be zero width, the same is true for the whole expression.

(if you have a single space in the source text, the "zero times space" is matched and the space itself is taken as necessary condition for this match)

[ ]* - alone would also match each zero width "nothing" between all characters

What specifically should be matched in this case?

"a space with any trailing spaces"

" +" (without quotes) would match one or more spaces (the [] aren't necessary as there is only one character).

Edited 1 time(s). Last edit at 2007-02-01 09:30 by vbr.

Options: Reply | Quote | Up ^


#56 Re: Multi-Line Search Testers Needed

Posted by: bee | Date: 2007-02-02 04:23 | IP: IP Logged

Hi all,

Thanks for the help and replies.

@vbr:
That's exactly what I did. But it didn't work. The plugin reported that there's 0 occurences. :(

If I use PSPad default/built-in search feature and using regex ($ symbol for line-end) it didn't work too. It did replace the ';' with ',' but didn't remove the newline(s). :(

This feature is the most I need since I do lots of operation like that for data/list manipulation. That's the only thing that prevent me using PSPad though I love other features. The best editor for this is NoteTab (http://www.notetab.com). Maybe you can learn from that editor for search/replace feature. If PSPad can do like that, I'll switch totally to PSPad since I don't really like NoteTab. grinning smiley

Options: Reply | Quote | Up ^


#57 Re: Multi-Line Search Testers Needed

Posted by: vbr | Date: 2007-02-02 09:27 | IP: IP Logged

Hi, thanks for the hint, as I see now, there might be some drawbacks of the new version of phreplace - 1.3.7 - non RE replacing of newlines definitely worked in previous versions.

Now replacing e.g.
"
"
with "; "
works only with single replace; not with replace all (in that case the "; " is only inserted before the line endings, which remain in the text)

This possibly can be due to the updates of "replace all", however, I like the enhanced performance in other aspects.

Regarding the modus of single replace mentioned above (#51) I agree with the author's decision to highlight the found string after the first click, as it is the behaviour of some other editors too.

There also remain some problems with \n in RE mode - the first character of next line gets highlighted and also replaced! - but the actual line end doesn't.

(Single replace of "\r" (although in DOS CR+LF file) using RE is able to realy join lines without loosing other characters; but "replace all" leaves line ends untouched)

I belive this problems can be solved at once if the native regexp replace could be implemented (#54).

Options: Reply | Quote | Up ^


#58 Re: Multi-Line Search Testers Needed

Posted by: oO_KIWI_Oo | Date: 2007-03-24 12:43 | IP: IP Logged

Thanks for your helpful tool! I use it very often smiling smiley

This day I have encountered a bug: For some reason some times your program does not replace all text I select.

E.g. I picked this one:


<body>
<div id="page_margins">
<div id="page" class="hold_floats">
<!-- #header: Beginn Skiplinks und Logo -->
<div id="header">
<div id="topnav">
<!-- Start: Skiplink-Navigation -->
<a class="skip" href="#navigation" title="Direkt zur Navigation springen">Zur Navigation springen</a> <a class="skip" href="#content" title="Direkt zum Inhalt springen">Zum Inhalt springen</a> <!-- Ende: Skiplink-Navigation -->
</div><img src="img/crossbase-logo-internet.gif" alt="crossbase-Logo" />
</div><!-- #header: Ende Skiplinks und Logo -->
<!-- #nav: Beginn Hauptnavigation -->
<div id="nav">
<a id="navigation" name="navigation" class="anchor">&nbsp;</a> <!-- Skiplink-Anker: Navigation -->
<div id="nav_main" class="clearfix">

and replaces it with a single word. In this case the following code was not replaced:


s="clearfix"

Options: Reply | Quote | Up ^


#59 Re: Multi-Line Search Testers Needed

Posted by: syntech | Date: 2007-05-07 13:32 | IP: IP Logged

Is there a change that this plugin will feature multi-file search/replace without having to have the files open? With some kind of file dialoge like I have with Alt-F?

From time to time I have to do search/replace works over 15 files, and having them open in PSPad slows everything down with Alt-F. So I'm using a wildcard and let PSPad do the work. It's all fine, except that I can't do mulit-line search/replace.

That's why I'm asking. smiling smiley

Options: Reply | Quote | Up ^


#60 Re: Multi-Line Search Testers Needed

Posted by: mroswell | Date: 2007-05-11 13:02 | IP: IP Logged

Here's everything I went through to install this (finally successful.)

Downloaded zip file
Extracted to directories
Closed and opened PSPad
Tried running Multiline search
Got error message
Tried renaming PSPad directory thinking that would help.
Opened and read txt file
Copied the dll to the windows system directory
Found cmd prompt
Ran the following command:
prompt: regsvr32 "phreplace.dll"
(because that's how it looks here:
www.phdesign.com.au

Finally figured out that I need to type only
regsvr32 "phreplace.dll"
(and copy and paste didn't work.)

This was a bit of a bear. Any way to get it to work upon first install?

Also, any way to get this functionality included into default PSPad?

(I like the appearance of the original search tool better, by the way.)

Also, I find it hard to get my fingers to do Ctrl-Alt-F.

Hope this feedback is helpful. Overridingly pleased to have found this tool!

Margie

Options: Reply | Quote | Up ^


Goto Page: Previous1 2 3 4 5 6 7 8 9 10 11 ...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