Logo Text Blaze

  • Docs
  • Community
  • Business
  • Documentation

    No search results

    Text Blaze

    Loading...

    Data Blaze

    Loading...

    Community Forums

    Loading...
  • Products
    • Text Blaze
      Snippets and templates
    • AI Blaze
      AI writing and editing
    • Data Blaze
      Tables and sheets
    Downloads
    • Add to Chrome
    • Windows app
    • MacOS app
  • By function
    • Support & operations
    • Sales
    • Healthcare
    • Education
    • Recruiting
    • Marketing
    Business
    • For teams
  • Resources
    • Documentation
    • Community forum
    • Gallery
    • Contact us
  • Pricing

Documentation

No search results

Text Blaze

Loading...

Data Blaze

Loading...

Community Forums

Loading...
Add to Chrome –  It's Free! Go to Dashboard ›
Docs > Commands
  • Guides
    • Quick Start
    • Sharing Snippet Folders
    • Dynamic Commands
    • Date and Time
    • Autopilot
    • Forms
    • Formulas
    • Rules & Validation
    • Tables in Snippets
    • Connect Other Apps
    • Tidying Whitespace
    • Lists
    • Read Data from Websites
    • Teams and Organizations
  • Tutorial Videos
  • Gallery
  • Frequently Asked Questions
  • Formula Reference
  • Dynamic Commands
    • Using Dynamic Commands
    • {=} (Formula Command)
    • {button}
    • {click}
    • {clipboard}
    • {cursor}
    • {error}
    • {formdate}
    • {formmenu}
    • {formparagraph}
    • {formtext}
    • {formtoggle}
    • {if}
    • {import}
    • {key}
    • {link}
    • {note}
    • {repeat}
    • {run}
    • {site}
    • {snippet}
    • {time}
    • {user}
    • {wait}
  • Connected Snippets
    • Connected Snippets Overview
    • {image}
    • {urlload}
    • {urlsend}
    • {dbselect}
    • {dbinsert}
    • {dbupdate}
    • {dbdelete}
  • Command Packs
    • Capitalize
    • Gmail
    • LinkedIn
    • Randomize
Commands

{clipboard}

Summary: Inserts the current clipboard contents.
Sample Usage
You've copied: {clipboard}
_

Quick Overview Video

Settings


Setting NameTypeDescription
General Command Settings
trimyes/no/left/rightIf yes whitespace is removed before and after the command. If left, only whitespace to the left is removed. If right, only whitespace to the right is removed.

The clipboard command will insert the entire contents of your clipboard.

In many cases, you will only want to insert a part of the contents of your clipboard.

Referencing a part of the clipboard

A very common use case with the clipboard command is only referencing a specific part of the data in your clipboard.

For example, you may have a customer case management system where data could be copied in the following format:

If you wanted to create a snippet that automatically used the name and phone number, you could do that using the clipboard command combined with the {=} (Formula Command) command to reference specific fields.

The following example shows this.

To see this example work, please do the following:

  1. Copy the text in the text box above
  2. Reload this page so that the example uses your updated clipboard.
  3. You will need to grant this website permission to access your clipboard.
Using Structured Data from the Clipboard
Hi {=extractregex({clipboard}, "Name: (\w+)")},

I wanted to follow up on your issue. If I don't hear from you this week I will give you a call at {=extractregex({clipboard}, "Phone number: (.+)")}.
_

The example above uses the extractregex function. This function uses a regular expression to precisely define what items of the clipboard you want to use. You can learn more about regular expressions in Text Blaze here.

Referencing specific data in your clipboard with regular expressions

The following examples assume your computer's clipboard contains the following text:

Name: John Smith
Age: 32
ID: RFS4215

If you have not yet copied the text and reloaded this page, please do so now.

If you don't, you are going to see a lot of "No match found" errors in the following examples.

To reference the name from this text, we could use the following regular expressions:

Referencing name examples
The full name is: {=extractregex({clipboard}, "Name: (.+)")} The first name is: {=extractregex({clipboard}, "Name: (.+?) ")} The last name is: {=extractregex({clipboard}, "Name: .+? (.+)")}
_

Now let's write a regular expression to get the user's age. Here we show a couple different approaches:

Referencing age examples
The age is: {=extractregex({clipboard}, "Age: (.+)")} The age is: {=extractregex({clipboard}, "Age: (\d+)")} The age is: {=extractregex({clipboard}, "Age: ([0-9]+)")}
_

There are many ways to write a regular expression to grab a specific result that you're looking for.

Diving in-depth into Regular Expressions is out of scope for this documentation page.

To learn more, visit the section on Regular Expressions in the Blaze Formula Reference page.

Handling badly formatted data

Occasionally, you will try to use a regular expression on data that is incorrectly formatted so that the regular expression does not correctly match the data.

For example, imagine the following data was given to you:

Name:
Age: 32
ID: RFS4215

The data is missing the name. If you use the regular expression from the previous section to process this you'll get a "No match found" error.

Sometimes you want to explicitly want an error to occur, but other times you want to insert a fallback value when the regular expression match fails.

There are two basic ways to handle these cases:

  1. Using the catch() function.
  2. Using the {if} command and the testregex function.

Handling errors with the catch() function

The catch() function evaluates its first argument and returns it.

However, if an error occurs when it is evaluating its first argument, it will return the second argument as a fallback.

Here is a quick example of the catch() function in action:

Catch() example
10 / 2 = {=catch(10 / 2, "could not calculate")} 10 / "dogs" = {=catch(10 / "dogs", "could not calculate")} (It's not possible to do division with the string "dogs")
_

Here's another example using the catch() function together with a regular expression:

Catch() and regular expressions
Dear {=catch(extractregex({clipboard}, "Name: (.+?) "), "Customer")},

Thank you for...
_

If the contents of your clipboard contains the correctly formatted text "Name: John", for example, the snippet will output "Dear John".

If the regular epression above does not match with the contents of the clipboard, then there will be an error. In that case the catch() command's second argument will output. It will display "Dear Customer".

Handling errors with the if command and the testregex() function

The testregex() function returns a Boolean (yes/no) which can be used as a condition in the {if} command.

{if} and testregex() example
Dear {if: testregex({clipboard}, "Name: (.+?) ")}{=extractregex({clipboard}, "Name: (.+?) ")}{else}Customer{endif},

Thank you for...
_

That's a very short introduction to using regular expressions together with the clipboard command to only grab the data that you need.

To go more in-depth, see the Regular Expressions section of the Formula Reference page.

About

Plans and Pricing
Sharing Snippets
Text Blaze for Business
Forms
Autopilot
Dynamic Commands
Command Packs
Text Blaze for Windows
Text Blaze for macOS

Support

Get Started with Text Blaze
Contact Us
Documentation
Community Forum
Blog
Gallery
Engineering Blog

Solution for

Business
Customer Support
Recruiters
Education
Healthcare
Sales
Property Managers
AI

Other

Privacy Policy
Terms of Service
Open Source Licenses
Affiliate
© Blaze Today Inc