You are here: PSPad forum > English discussion forum > Re: Multitags/MultiLine search (regex issue)

Re: Multitags/MultiLine search (regex issue)

#1 Multitags/MultiLine search (regex issue)

Posted by: Haunebu | Date: 2021-03-28 08:28 | IP: IP Logged

I'm having trouble finding two tags at once (2 lines). I have tried various regular expressions found on the internet but it still returns no results. I can not deal with it.

2 line:
<h1>title</h1>
<div class="titleuser"><em><a href="/user/username">my user name</a></em></div>

Edited 3 time(s). Last edit at 2021-03-28 08:30 by Haunebu.

Options: Reply | Quote | Up ^


#2 Re: Multitags/MultiLine search (regex issue)

Posted by: vbr | Date: 2021-03-29 14:07 | IP: IP Logged

Haunebu:
I'm having trouble finding two tags at once (2 lines). I have tried various regular expressions found on the internet but it still returns no results. I can not deal with it.

2 line:
<h1>title</h1>
<div class="titleuser"><em><a href="/user/username">my user name</a></em></div>

Hi, unfortunately, this is a known limitation of the current editor component - the search and replace functions work on individual lines, the match then cannot span multiple lines.

It can be worked around by using scripting; or in some cases one can e.g. join the lines using some unique sepator, perform the search on that and split the lines back - but it is not straightforward.
You may try e.g. phReplace from the pspad extension list:
www.pspad.com

Or my much simpler, older script:
www.vbr.wz.cz
the search pattern for your example would be (after escaping the slashes):
/<h1>title<\/h1>\s*\r\n<div class="titleuser"><em><a href="\/user\/username">my user name<\/a><\/em><\/div>/g

Regards,
vbr

Options: Reply | Quote | Up ^


#3 Re: Multitags/MultiLine search (regex issue)

Posted by: Haunebu | Date: 2021-03-29 16:23 | IP: IP Logged

The pattern does not match. Nothing was found.

Options: Reply | Quote | Up ^


#4 Re: Multitags/MultiLine search (regex issue)

Posted by: Haunebu | Date: 2021-03-29 18:09 | IP: IP Logged

Invalid \s*\r\n

Options: Reply | Quote | Up ^


#5 Re: Multitags/MultiLine search (regex issue)

Posted by: vbr | Date: 2021-03-29 22:24 | IP: IP Logged

Hi,
that pattern is supposed to match your example using the mentioned javascript add-on for PSPad (for the search function)

It won't work in the bulitin search dialog in PSPad (and any other pattern won't currently work either, as the match can't span multiple lines - in the current implementation).
hth,
vbr

Options: Reply | Quote | Up ^






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