- Print
How to add a Regular Expression to a Trigger
Overview
Regular Expressions are a useful tool to create patterns that help match and locate text/strings stored in a database.
Regular Expression is commonly abbreviated as “regex” and is similar to expressions used in Microsoft Excel as well as that used in programming languages like Perl.
How To
To utilize the Regular Expression tool you will first have to create a Variable. Once created, you can easily add a Regular Expression as a condition in a Trigger.
The following guide will help you create one in Tulip:
How to identify certain barcodes
1- Open a step within the desired app in the Tulip App Editor.
2- Select the Trigger by clicking on the plus icon under the Step Tab in the Context Pane.
Name the Trigger by filling out the title at the top of the Trigger Editor.
Set the Event:
- Select “device” in the drop down menu
- Select “Barcode Scanner” in the second drop down menu
- Select “this station” in the third drop down menu
5-Set a Condition:
- Click the “Add New Condition” button on the right side of the window in the If section.
- Select “Variable” in the drop down menu.
- Select the Variable you created in the drop down menu Eg. Assembly Barcode.
- Select “Matches Regular Expression” in the drop down menu.
- Select “Static value” in the drop down menu.
- Select “text” in the drop down menu.
- Type out the Regular Expression in the final box. Eg.[U]+[a-zA-Z0-9].{9}
- This Expression looks for Barcodes that start with a capital ‘U’ and has nine additional characters in it.
- Set an Action:
- Click the “Add New Action” button on the right side of the window in the Then section.
- Select “Go To Step” in the drop down menu.
- Select the desired action in the drop down menu. Eg. Next.
Here's what the full Trigger looks like:
To learn more about how to use regex, here is a tool that we found helpful.
In order to effectively use the link, please type a sentence/paragraph in the text box (2) and use the Expression Section (1) to define the conditions of your search.
The Tools section (3) will explain the function of each command in your expression. The Cheatsheet and Community Tabs (4) are other useful tools to build better expressions.
Did you find what you were looking for?
You can also head to community.tulip.co to post your question or see if others have faced a similar question!