outwit.com
Query Generation Matrices (pro version)

OutWit's simple string sequence generation format.

This function allows you to generate a series of strings using a simple "matrix" string where variable or incremented parts are expressed between brackets.
The most frequent use of this function is the generation of URLs that will be used to execute queries from online sources (hence the name).

This feature is used in several parts of the program:

What are Query Generation Matrices?

Imagine you wish to scrape a database, wikipedia pages or search engine results for the birth date of musicians (say: Wolfgang Amadeus Mozart, Franz Liszt, Johannes Brahms, Frederic Chopin).

You can, for instance, want to visit the following pages:

With OutWit, you will be able to define the queries as a single matrix string:
http://www.myMusicDB.org/search?[Wolfgang Amadeus Mozart;Franz Liszt;Johannes Brahms;Frederic Chopin]

or, for a series of pictures:
myFavoriteMovieStar[001:200].jpg,
which will generate the 200 names in the range.

NOTE: For now, as the feature is mostly used to generate URLs, all space characters are replaced by %20. We will add more intelligence to the code in a later version to automatically decide whether the replacement should be done or not.

Types of ranges:

Numerical Increments:

Use [xx:yy] to define the range of numerical indexes to increment. (If you put leading zeros, OutWit will add leading zeros in the whole series.)

Example:

string[5:11] will generate the following sequence: string5, string6, string7, string8, string9, string10, string11
string[095:101]will generate the following sequence: string095, string096, string097, string098, string099, string100, string101
string[312:309] will generate the following sequence: string312, string311, string310, string309

Alphabetical Increments:

Use [aa:bb] to define the range of alphabetical indexes to increment.

Example:
string[A:D] will generate the following sequence: stringA, stringB, stringC, stringD
string[auz:avb] will generate the following sequence: stringauz, stringava, stringavb
string[z:u] will generate stringz, stringy, stringx, stringw, stringv, stringu

Series of Values

Use [one;two;three;four] to define a series of values.

Example:

"[jan;feb;mar;apr;may;june], [01:31]" will generate all combinations between "jan, 01" and "june, 31" (Yes, it will create 31 days in each month.)

Step

Use [xx:yy/5] to define a step of 5 between the generated values.

Synchronized series and ranges

Use [#n#a;b;c;d;e] to mark groups of series that must be incremented together item by item, without generating all possible combinations:

Examples:

firstName=[#1#peter;mike;john;martin]&lastName=[#1#black;wilson;moore;woods] will only generate:
firstName=peter&lastName=black
firstName=mike&lastName=wilson
firstName=john&lastName=moore
firstName=martin&lastName=woods

fromYear=[#1#1960:2000/10]&toYear=[#1#1969:2009/10] will generate:
fromYear=1960&toYear=1969
fromYear=1970&toYear=1979
fromYear=1980&toYear=1989
fromYear=1990&toYear=1999
fromYear=2000&toYear=2009

Variables:

Prompt:

Use [#ASK#] if you wish to be prompted for a value at the time of resolution of the matrix. (Do not use this option if the matrix is to be used in a job that you wish to execute in your absence.) Note that you can use the OutWit Query Generation format in the string you type here.

Time Variables:

Use [#YEAR#], [#MONTH#], [#DAY#], [#HOURS#], [#MINUTES#], [#SECONDS#], [#MILLISECONDS#], [#DATE#], [#TIME#], [#DATETIME#] to insert the respective values in your string.

Example:
www.myCompany.com/monthlyReport/[#YEAR#]/[#MONTH#]/ will generate the following string: www.myCompany.com/monthlyReport/2010/09/ (... if executed in september 2010).

Random:

Use #RANDOM[xx:yy]# if you wish to generate a random integer. This will only generate one integer. If you want a series of random numbers, you can use: [#RANDOM[xx:yy]#;#RANDOM[xx:yy]#;#RANDOM[xx:yy]#;...]. (Note that this feature only works with digits at the moment.)

Escaping Characters:

If you wish to use one of the reserved characters in a matrix, excape it as you would for a regular expression. This means that if you need to use one of the following characters ; : [ or ], you need to type a \ before it.