Back to Agent Ransack Home page

 

Quick Start
[Previous] [Main] [Next]


Agent Ransack is a file searching tool based upon a descriptive standard called 'regular expressions' (some times shortened to regexp). Regular expressions provide a concise language to describe exactly what you are searching for. In very basic terms you can split an expression into two parts:
- what you are looking for
- the number of occurrences you want to find of it.

Note: Before following these examples make sure you go to the Options tab and ensure that filename is Regular Expression and NOT DOS Expression.

So let's take an example:
1. I want to find all files named abc, abbc, abbbc, abbbbc etc. So basically I want to find all files that begin with 'a' followed by one or more 'b' then followed by 'c'. The expression would be:
ab+c

Breaking that apart we read:
- find one occurrence of 'a'
- find at least one occurrence of 'b' (the '+' indicates 'one or more')
- find one occurrence of 'c'

The characters that specify the number of occurrences are:
+ one or more
* zero or more
? zero or one

So ab?c would find any file named abc or ac (i.e. there can be zero or one 'b').

A very important regexp character is the period '.' because it matches to ANY character. So a.c would match to aac, abc, acc, adc, aec, afc, a1c, a6c etc. And if we combine that with an occurrence character we can start producing some useful expressions:
dave.*vest

breaks down to:
- find one occurrence of 'd'
- then one occurrence of 'a'
- then one occurrence of 'v'
- then one occurrence of 'e'
- then zero or more occurrences of ANY character
- then one occurrence of 'v'
- then one occurrence of 'e'
- then one occurrence of 's'
- then one occurrence of 't'

and so matches to 'davevest', 'dave vest', 'dave is wearing a vest'.

There are other regexp characters and tricks on the following pages. More detail on regular expressions.