Typinator power tips

This page contains a collection of useful power tips and tricks to help you get the most out of Typinator. We hope you find some of these power tips useful for your work flow.

If you want to share your own power tip with the Typinator community, please contact us. We will gladly publish your contribution here.


Inserting random text without any programming knowledge
























previous Previous   Next next

To create dynamic parts of expansions (such as results of computations or random snippets), you can embed scripts in Typinator expansions. But there are many cool effects that you can produce without any programming knowledge, just by using Typinator’s built-in functions.

For example, assume you want to insert a random phrase in an expansion. This could be a greeting, a quotation, a random offer of your most popular products, and much more. You can produce such random text fragments with Typinator’s /Any function.

To insert an invocation of the function in an expansion, click the {…} pop-up and select “Any match” from the “Built-in Functions” submenu. As a result, you get the following template:

{/Any /pattern/text/}

“pattern” is a regular expression, and “text” is a longer text fragment. The function looks for all matches of the regular expression in the text and returns a random match. Here is a simple example for rolling dice:

{/Any /./123456/}

The period stands for any single character, so the pattern matches each of the six digits in the text. The /Any function now randomly selects one of the digits.

To return a whole word from a longer text, change the pattern to match a non-empty sequence of “word characters”. The regular expression \w stands for a word character (letter or digit), and the plus sign means a non-empty repetition of the previous expression. The following invocation returns one of the five animals:

{/Any /\w+/cat dog mouse elephant snake/}

For longer phrases, you can use the pattern .+, which stands for a non-empty sequence of arbitrary characters. By default, line breaks are not included in such sequences, so you can write your phrases in multiple lines. Here is an example that selects one of five quotes of Albert Einstein:

{/Any /.+/
Gravitation is not responsible for people falling in love.
I never think of the future. It comes soon enough.
Everything should be made as simple as possible, but not simpler.
Imagination is more important than knowledge.
Weakness of attitude becomes weakness of character.

You can take this one step further by including a text file containing your favorite quotes. For example, create a plain text file with one quote per line and put it into the “Text” subfolder in Typinator’s “Includes” folder. Then you can use the /Any function to select a random quote from the text file:

{/Any /.+/


This web site uses cookies to provide best possible experience and service for you. By continuing surfing this site you agree to use cookies. Click here for details.