Page 1 of 1

Multiline find - how do I accomplish this?

Posted: Sun Mar 12, 2006 3:51 pm
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

Posted: Sat Mar 18, 2006 6:02 pm
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 \

Posted: Mon Mar 20, 2006 2:06 pm
by marciohumpris
Hi,

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

Where is this modifier S?

thanks.

Posted: Mon Mar 20, 2006 2:26 pm
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\[

Posted: Tue Mar 21, 2006 3:38 pm
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.

Posted: Tue Mar 21, 2006 3:39 pm
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

Posted: Fri May 12, 2006 5:30 pm
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.

Posted: Fri May 12, 2006 6:13 pm
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.