[WDX] PCREsearch

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
nsp
Power Member
Power Member
Posts: 1938
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: [WDX] PCREsearch

Post by *nsp »

andry81 wrote: 2025-05-22, 01:12 UTC Tried to search bat files for multi line comments:

Plugin: Property: OP: Value:
pcresearch Random String regex (?s)(rem[^\r\n]*\r?\n){3,}
You need to use multi-line (?m) flag to match multiple line. You can also use Ignore case i.
The following expression should work.

Code: Select all

(?mi)(rem[^\r\n]*\r?\n){3,}
andry81
Member
Member
Posts: 123
Joined: 2018-11-22, 19:17 UTC

Re: [WDX] PCREsearch

Post by *andry81 »

nsp wrote: 2025-05-22, 03:24 UTC
andry81 wrote: 2025-05-22, 01:12 UTC Tried to search bat files for multi line comments:

Plugin: Property: OP: Value:
pcresearch Random String regex (?s)(rem[^\r\n]*\r?\n){3,}
You need to use multi-line (?m) flag to match multiple line. You can also use Ignore case i.
The following expression should work.

Code: Select all

(?mi)(rem[^\r\n]*\r?\n){3,}
Still does not work.

Is that the MultiLine does match each line before the CR/LR? Then the "\r?\n" nor "{3,0}" has no sense here.
User avatar
nsp
Power Member
Power Member
Posts: 1938
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: [WDX] PCREsearch

Post by *nsp »

andry81post_id=471966 wrote:2025-05-22, 03:24 UTC Still does not work.

Is that the MultiLine does match each line before the CR/LR? Then the "\r?\n" nor "{3,0}" has no sense here.
The expression only match file where moe than 3 lines start with REM.
?m indicate that the expression can be matched by more than one line
{3,} means more than 3 line
Give a try with

Code: Select all

REM ---------------------------------------------
REM sample.bat for PCREsearch.wdx
REM ---------------------------------------------
echo  sample.bat
If you have space before rem, you should add \s* before rem.
you should have a definition in pcresearch.ini like (adapt the 4 number by your first emply slot)

Code: Select all

;;;;;      More then 3 consecutive REM lines
regex4=(?im)(\s*rem[^\r\n]+\r?\n){3,}
regex4name=Multi REM
regex4type=0
regex4flags=0
When you search set *.bat *.cmd as file name,
On plugin tab, select [pcresearch] . [Multi REM] [=] Yes

--- Edited --
I use version 2.5.0.0
wdx64 MD5,1eae46ee36f7daa4f60daf6c8e2636fb
see config:
Image: https://postimg.cc/2L77JVSX
andry81
Member
Member
Posts: 123
Joined: 2018-11-22, 19:17 UTC

Re: [WDX] PCREsearch

Post by *andry81 »

nsp wrote: 2025-06-06, 04:20 UTC you should have a definition in pcresearch.ini like (adapt the 4 number by your first emply slot)
1. You had to restart TC to use `Multi REM`.
2. I want to use the regexp expression in the `Value` field on the plugin tab. It can change after the result is found. I don't want to create a new expression in the config each time. It has a too much of hands movement.
User avatar
nsp
Power Member
Power Member
Posts: 1938
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: [WDX] PCREsearch

Post by *nsp »

andry81 wrote: 2025-06-12, 09:33 UTC 2. I want to use the regexp expression in the `Value` field on the plugin tab. It can change after the result is found. I don't want to create a new expression in the config each time. It has a too much of hands movement.
wdx do not work like this in the value field, you search for a result and you do not pass anything to the plugin except field and unit.
TC do matching.
Currently TC Regexp do not accept multi-line expression. (give a look to the regexp help about Modifiers )

Only way to pass an expression to wdx is to use a search content field (start with !) filling find text field for dynamic expression. PcreSearch do not support it.
Post Reply