Multiline find - how do I accomplish this?

General discussions about Advanced Find and Replace
Post Reply
marciohumpris
Posts: 4
Joined: Sun Mar 12, 2006 3:45 pm

Multiline find - how do I accomplish this?

Post by marciohumpris »

Friends,

Im testing AFR and want to do the following... In this text file (FTP program Serv-U ini file), I wanna find the users who dont have Timeout= and MaxNrUsers=2 defined.

I tried something lke RelPaths=1\n[

But it didnt work. The goal is to find user X below, since after Relpaths=1, theres [USER... And that doesnt exist for the ones that have Timeout and MaxNrusers which come after Relpaths.

See:

[USER=joe|1]
HomeDir=c:\y
Password=sadsadsa
Access1=c:\y|RWAMLCDP
RelPaths=1
TimeOut=3600
MaxNrUsers=2
[USER=x]
HomeDir=c:\x
Password=xyz
Access1=c:\x|RWAMLCDP
RelPaths=1
[USER=maria|1]
HomeDir=c:\y
Password=sadsadsa
Access1=c:\y|RWAMLCDP
RelPaths=1
TimeOut=3600
MaxNrUsers=2

How can I accomplish this?

Thanks a lot,
Marcio

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Yes, it's possible you should use the search for:
(USER=\w+\].*RelPaths=\d+.*)\r\n\[

Also "modifier S" should be checked.

BTW concerning your regular expression:
[ is a reserved char and you should escape it with \
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

marciohumpris
Posts: 4
Joined: Sun Mar 12, 2006 3:45 pm

Post by marciohumpris »

Hi,

Thanks a lot. Can you give me a step by step?

Where is this modifier S?

thanks.

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Sorry, step by step instructions:
Go to main menu - Action - Options - Batch Replace
check "Modifier S"

Go to Batch replace tab,
check on "Use regular expressions".
check "Just find" option

Put into the grid, search for:
(USER=\w+\].*RelPaths=\d+.*)\r\n\[
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

marciohumpris
Posts: 4
Joined: Sun Mar 12, 2006 3:45 pm

Post by marciohumpris »

Dear Roman,

I tried that and it doesnt work... I click find and nothing is found. Can you please double check for me if it works?

I checked S modifier and in batch replace chose JUST FIND and use regex. Clicked on Execute, nothing found.

marciohumpris
Posts: 4
Joined: Sun Mar 12, 2006 3:45 pm

Post by marciohumpris »

Roman,

Maybe I wasnt clear.

In the case below, I wanna find all the ones that after RELPATHS have a CR and [USER or something like that.

The goal is to find the ones that dont have timeout= and maxnrusers=

Thanks a lot!

[USER=joe|1]
HomeDir=c:\y
Password=sadsadsa
Access1=c:\y|RWAMLCDP
RelPaths=1
TimeOut=3600
MaxNrUsers=2
[USER=x]
HomeDir=c:\x
Password=xyz
Access1=c:\x|RWAMLCDP
RelPaths=1
[USER=maria|1]
HomeDir=c:\y
Password=sadsadsa
Access1=c:\y|RWAMLCDP
RelPaths=1
TimeOut=3600
MaxNrUsers=2

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

The problem is the following:
AFR uses standard (classical) regular expressions. According to these
expressions you may create expressions that match to given text.
But you cannot create expressions that does not include the text.

So you may easily create expression which finds all users having
timeout= and maxnrusers= text. But it's impossible to find users not
having timeout= and maxnrusers= text.

What we are thinking about: maybe we may extent standard regular
expressions by adding the command to find text not having given
substring.

We recorded it into our ToDo list. We will send you email when it will
be ready.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Well... we found how can we do that!

I said it's impossible to find text not having substrings.
But what we can do: take your INI file and remove from the users
having
Timeout= and MaxNrUsers=
what will be left in the INI file? Users not having Timeout= and
MaxNrUsers= !

So you may use the software already now.

Step by step instructions.

When you need to find users not having Timeout= and MaxNrUsers=
take
your INI file and put it (copy) into temp folder. For example,
C:\Program Files\Advanced Find and Replace\test

Start AFR.

Put the following two lines into Batch grid:
search for:
USER=.*\].*Timeout=\d+.*\r\n\[
replace with:
(empty)

USER=.*\].*MaxNrUsers=\d+.*\r\n\[
replace with:
(empty)

Modifier S should be ON in Options window (as described in the message above).

Select correct Search Path (your temp folder).

Press Execute button.

That's all.

Let us know if you have any other questions.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply