Typinator includes built-in functions you can use inside expansions to transform text automatically.
They always start with a slash and look like this:
{/FunctionName parameters}Text formatting
-
{/Lowercase text} → makes text lowercase
{/Lowercase Hello WORLD} → hello world -
{/Uppercase text} → makes text uppercase
{/Uppercase Hello WORLD} → HELLO WORLD -
{/Capital text} → capitalizes each word
{/Capital hello world} → Hello World
Tip: If an abbreviation consists of letters, you can also use the pop-up menu next to the abbreviation to specify how Typinator should handle the capitalization of the expansion. You can read more about case variations here.
HTML helpers
-
{/DecodeHTML text} → converts HTML entities to readable characters
{/DecodeHTML Österreich} → Österreich -
{/EncodeHTML text} → converts reserved characters for HTML
{/EncodeHTML Miller & Sons} → Miller & Sons
Useful tools
-
{/Length text} → counts characters
{/Length Hello} → 5 -
{/Repeat n/text} → repeats text n times
{/Repeat 3/Ho, /} → Ho, Ho, Ho, -
{/Unicode number} → inserts the Unicode character with the given character number
{/Unicode 8984} → ⌘
(You can enter multiple numbers separated by spaces or commas.)
Tip: If you are interested in the Unicode Character map, Popchar might be exactly what you need! Check it out!
Extracting parts of text
-
{/Left n/any text} → returns the n leftmost characters of any text
{/Left 3/Typinator/} → Typ -
{/Right n/any text} → returns the n rightmost characters of any text
{/Right 3/Typinator/} → tor -
{/Mid start/n/any text} → returns n characters in the middle of any text, starting at start
{/Mid 3/3/Typinator/} → pin
Replace & regex
-
{/Replace /original/replacement//any text/} → replaces all occurrences of original in any text by replacement
{/Replace /s/abra//scads/} → abracadabraThis function can contain multiple original/replacement pairs, delimited by //, as in:
{/Replace /1/one/2/two/3/three//1234} → onetwothree4
Tip: You can use the {/Replace} function to insert phrases depending on the time of the day. Check out this article to learn more!
-
{/Regex /original/replacement//any text/} → similar to /Replace, but with regular expressions
{/Regex /([A-Z])([0-9])/$2$1//This is A1 quality./} → This is 1A quality.
Tip: When filling out online forms, you often copy and paste information from other sources. However, many forms require numbers to be entered in a specific format, for example without spaces or separators. The {/Regex} function can help you by automatically removing all non-digits from the text in the clipboard. Check out our tutorial!
Choose & conditions
-
{/Choose x/text1/text2/text3/.../} → inserts one of the text items text1, text2, etc.
The first parameter (x) determines which item is chosen. x can be:-
a number, which is taken as the index of the desired item:
{/Choose 2/one/two/three/} → two -
a regular expression pattern, which chooses the first matching item:
{/Choose r/one/two/three/} → three (the first item containing “r”) -
an asterisks, which chooses an arbitrary item:
{/Choose */one/two/three/} → a random choice of “one”, “two”, or “three”
-
a number, which is taken as the index of the desired item:
-
{/Case /value/case1/result1/.../default result/} → compares the given value with “case values” and returns the corresponding result of the first match. If nothing matches, it uses the final value as the default result.
{/Case /2/1/one/2/two/more/} → two
Tip: Use the {/Case} function to insert dates with an ordinal number. Check out this article for the tutorial.
Search & lList
- {/Count /pattern/text/} → counts matches
- {/Index n/pattern/text/} → returns the n-th match
- {/List /pattern/separator/text/} → lists all matches
- {/Any /pattern/text/} → returns a random match
Tip: The {/Any} function can help you if you want to insert random text without any programming knowledge. We have an article explaining this in detail, check it out!
Other functions
- {/Extract /before/after//text/} → extracts text between markers
- {/Sort text} → sorts lines alphabetically
- {/URL http://...} → fetches a web page and inserts its content
Tip: If your text contains /, you can use another character instead (like :).
Let's combine it!
Built-in functions are most powerful when combined with other markers. The possibilities are virtually endless. Here are just a few examples that illustrate what you can do with these functions:
- {/Uppercase {clip}} → text from the clipboard, converted to upper case.
- {/Regex / +/ //{clip}/} → text from the clipboard, with multiple spaces removed.
- {/Replace /{{?Original}}/{{?Replacement}}//{clip}/} → asks for “Original” and “Replacement”, replaces all occurrences in the text found in the clipboard, and returns the resulting text.
- {/Count /[:upper:]{2,}+/{clip}/} → analyzes the contents of the clipboard and returns the number of words that contain only uppercase letters and are at least two letters long.
- {/Case /{{dayDelta}}/0/today/1/tomorrow/in {{dayDelta}} days/} → uses the {{dayDelta}} variable to generate a relative date (“today” for 0, “tomorrow” for 1, and “in x days” for all other values).
Tip: Check out this blog article, if you want to learn more about date calculations with Typinator.