? about Agent Ransack

R

Robert

I am trying to search a bunch of files on a windows xp computer for
certain text strings, which are not necessarily on the same line in
the document. Is there anyway to do this type of search with Agent
Ransack? I am able to search for multiple strings if they are on the
same line, however my search results come up blank when the strings I
am looking for are on different lines in the document.

iow: if I have the following document

I would like to confirm our appointment.

and I search for (I'm not using the " in the search) "confirm
appointment" it returns my document.

however if the document is in the following format

I would like to confirm
our appointment with the doctor.

Assuming they are on different lines in the document my search comes
up blank.

Am I overlooking something or can this not be done.

Thanks.

Robert
 
B

B. R. 'BeAr' Ederson

I am trying to search a bunch of files on a windows xp computer for
certain text strings, which are not necessarily on the same line in
the document. Is there anyway to do this type of search with Agent
Ransack?

No. AgentRansack does a line-by-line search of your pattern. That's
why it will never find your strings parted by line breaks.

You need a program which provides multi-line capabilities. Some of
the command line driven grep-programs do. But you'll have (maybe?)
something GUI-based. InfoRapid Search&Replace will do for instance.

If you don't care whether there can be lots of text between your
search patterns you could use this in regular expression mode
(don't forget to switch the multiline option ON):

confirm.*our.*appointment

But that will sometimes return a lot of false positives. That's
why you're often better off using such a search string (every
other option set as mentioned above:

confirm our([[:space:]])*((\r\n)|(\n))?appointment

Of course you need to replace *every* whitespace with this
([[:space:]])*((\r\n)|(\n))?
search pattern. (I only used it once to keep it on one line.)

It tells to look if there is some space (zero or more occurrences)
present and if either a carriage return plus line feed (DOS/Win file)
or a simple line feed (UNIX file) is (maybe additionally) present
(0 or 1 times). You can of course extent this search pattern *much*
further to cover other needs...

HTH.
BeAr
 
R

Roger Johansson

No. AgentRansack does a line-by-line search of your pattern. That's
why it will never find your strings parted by line breaks.

You need a program which provides multi-line capabilities.

http://www.idiotsdelight.net/minitrue/

Minitrue can be used on exe files, on any files, while many other text
search and replace utilities need text files to work on, with linebreaks.
 
?

=?ISO-8859-1?Q?=BBQ=AB?=

"B. R. 'BeAr' Ederson" <[email protected]>
wrote in said:
If you don't care whether there can be lots of text between your
search patterns you could use this in regular expression mode
(don't forget to switch the multiline option ON):

confirm.*our.*appointment

But that will sometimes return a lot of false positives. That's
why you're often better off using such a search string (every
other option set as mentioned above:

confirm our([[:space:]])*((\r\n)|(\n))?appointment

Of course you need to replace *every* whitespace with this
([[:space:]])*((\r\n)|(\n))?
search pattern. (I only used it once to keep it on one line.)

What is that ([[:space:]])* construction?

I'd use a regex like confirm.{,20}appointment in multiline mode, to
search for the two words with <= 20 characters between them.
 
B

B. R. 'BeAr' Ederson

What is that ([[:space:]])* construction?

I provided the sample for InfoRapid Search&Replace, which I recommended
as a possible program fulfilling the task. It uses the above mentioned
construct as a class operator for 'space'. I didn't care to check the
degree of support for RegEx of S&R but used the point and click interface
to get a check task done. Because some programs have their own special
RegEx syntax, I don't expect a solution I often use myself with 'real'
grep programs to work. So - if I recommend using a program, which I
seldom use myself, I generally use its interface to built test tasks.
I'd use a regex like confirm.{,20}appointment in multiline mode, to
search for the two words with <= 20 characters between them.

Yes. If you want some kind of 'near' search. The string I provided
returns *exact* phrase match. Only space chars and line breaks between
the words are permitted. Regular expressions strongly depend on the
aim of a search. - As you know... ;-)

I don't think my solution the cleanest, fastest, or best in general.
It was a quick hack, simply to work as near to the task of the OP
as I got it without to much thinking. ;-)

BeAr
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top