Advanced Masterclass Notes - February 3rd 2022

Masterclass Video

Variables

Resources:

Working with Forms (Includes video)
Using clipboard contents in Text Blaze (video)

Snippets from the Masterclass:

Dear {formtext: name=firstname},

I see that {formtext: name=company} is looking for a strong full-stack engineer to own development of key front-end and back-end components of your application.

As a full-stack engineer with 6 years of experience, I feel that I have a lot to offer to {=company}.

Let's chat.

Here are the details of your order:

Quantity: {formtext: name=qty; default=2}
Price per item: ${formtext: name=price; default=2.99}

The total price is: {=qty * price; format=$,.2f}

Dear {formtext: name=fullname; default=Sherlock Holmes},

I'm currently researching the genealogy of the {=split(fullname, " ")[2]} lineage.

{name=split({clipboard}, "\t")[1]; trim=yes}{profession=split({clipboard}, "\t")[2]; trim=yes}{address=split({clipboard}, "\t")[3]; trim=yes}{referrer=split({clipboard}, "\t")[4]; trim=yes}

{=name}
{=replace(address, ", ", "\n")}

Dear {=name},

You were referred to us by {=referrer} as a person of trust.

We require your services as a {=profession} in a certain delicate matter.

{note} Command

Resources:

The {note} Command (includes video)

Snippets from the Masterclass:

{note}Don't forget to fill in the name field

{endnote: trim=right}

Dear {formtext}

{note: preview=no}LIVE SNIPPET - DO NOT MODIFY!

{endnote: trim=right}

What kind of error are you getting?

Regex

Resources:

Regular Expressions (includes video)
Special characters in regular expressions

Snippets from the Masterclass:

{formparagraph: cols=80; rows=8; name=text; default=Richard Wolff (born 12 June 1976 in Prague, Czechoslovakia)[1] is a motorcycle speedway rider who first rode in the UK for the Trelawny Tigers in the Premier League. He stayed with the Tigers until their closure in 2003. He then spent the 2005 season with the Reading Racers.}

Extracting the date of birth:
{=extractregex(text, "\d\d\s\w+\s\d\d\d\d")}.

Extracting the first two words and the date of birth, and putting them inside a sentence:
{=extractregex(text, "\w+\s\w+")} was born on {=extractregex(text, "\d\d\s\w+\s\d\d\d\d")}.

Extracting the first two words and the date of birth, and manipulating the date, and putting everything inside a sentence:
{=extractregex(text, "\w+\s\w+")} was born on {date=extractregex(text, "\d\d\s\w+\s\d\d\d\d")}{time: dddd, MMMM Do YYYY; at={=date}; pattern=DD MMMM YYYY}.

Source text - the text from where you want to extract something using regex:
{formparagraph: name=text; cols=50; rows=3; default=The phone number is 555-55555.}

Regex string - Where you'll build your regex pattern:
{formtext: name=regex; cols=50; default=\\d\\d\\d-\\d\\d\\d\\d\\d}

Syntax - What the final regex command will look like:
{=concat("{=extractregex(\"")}{=text}{=concat("\", \"")}{=regex}{=concat("\")}")}

Extracted - What your regex command has extracted from the source text:
{if: regex <> ""}{=catch(extractregex(text, regex), "No matches")}{endif}

Randomize Command Pack

Resources:

Overview of command packs (video)

Snippets from the Masterclass:

Will only work if copied to your dashboard and with the Randomize command pack installed.

{note: preview=no}
{data=["Dorian Gray", "Sybil Vane", "Henry Wotton", "Basil Hallward"]}
{names=split(data, ", ")}
{winner={random-number: min=1; max={=count(names)}; rounded=yes}}
{endnote: trim=yes}
Congratulations

{=names[winner]}

You get a {formtext: name=prize}

List of live attendees
as at {time: h:mm A [(GMT+1) on] dddd, MMMM Do, YYYY}:

{=join(names, ", ")}

3 Likes