A smart element connected to a website page (see What are Smart Elements and how to use them);
Purpose
Expression and Format change a value that Stripo pulls from a website before it goes into your email. Trim long titles, fix links, add text around a value, or show a price in the format you need.
When to use
Use Expression and Format when:
the price on the site looks different from the one you need in the email;
a link from the site has no protocol or uses a relative path;
a title or description is too long for the card.
They work only for data pulled from a website page. Values from a Data Source (Google Sheets, RSS, JSON) stay as they are, so prepare them in the source itself.
Here's what you'll end up with: a price that comes from the site as $1,699 and shows in your email as $1,699.00.
Where to find Expression and Format
Select the smart element and open the Data tab.
Click the Direction Rule icon (target) next to the field you want to change. The rule panel opens.
Fill in Selector and, if needed, Attribute to get the value from the site.
Click + Expression or + Format. To start from a ready-made pattern, click the arrow next to + Format and choose one.
Click Check Rule and Save.
You'll know it worked when the field in the card shows the changed value.
To remove an Expression or a Format, click the trash icon next to its name.
(!) Add Expression before Format (!)
Format works only with a plain number: digits and one decimal point, with no currency signs, commas, or spaces. If the site shows $1,699, Format can't read it and the value stays the same. Add an Expression that keeps only digits and the decimal point first, then add Format.
Change a value with Expression
An Expression has two fields:
Expression: a regular expression that finds part of the value;
Replace: what goes in its place. Leave it empty to delete the match.
The ready-made patterns under the arrow cover the most common tasks:
Ready-made pattern | Expression | Replace | Before | After |
Change the symbol to another one |
|
|
|
|
Trim text to a certain number of characters |
|
| A long title | The first 125 characters |
The link needs a protocol addition |
|
|
|
|
The link path needs to be changed |
|
|
|
|
Insert content inside the got content |
|
|
|
|
Other useful Expressions:
Task | Expression | Replace | Before | After |
Remove the currency sign |
| (empty) |
|
|
Keep only the number (Global on) |
| (empty) |
|
|
In the trim pattern, replace 125 with the number of characters to keep. It counts every character: letters, digits, spaces, and symbols. The text may break in the middle of a word.
Global
Each Expression has a Global checkbox. It's off by default.
On: Stripo replaces every match in the value.
Off: Stripo replaces only the first match.
For example, the value $$$$ with Expression \$ and Replace usd gives usdusdusdusd with Global on and usd$$$ with Global off.
Tip
Test your Expression on regex101 with the exact value from the site before you paste it into Stripo. To learn the syntax, see the JavaScript RegExp reference on W3Schools.
Format a number with Format
Format applies a number pattern to the value. Separator sets the grouping separator. If you leave it empty, Stripo uses a dot.
Character | What it does |
| Shows a digit, or 0 if there's none |
| Shows a digit, or nothing if there's none |
| Marks the decimal separator |
| Marks where to group digits (the symbol comes from Separator) |
| Adds text as is, for example |
Examples for the value 202.97:
Format | Separator | Result | What happens |
| (empty) |
|
|
| (empty) |
|
|
| (empty) |
| Rounds to the pattern's decimals |
| (empty) |
| Rounds to a whole number |
| (empty) |
| Groups digits with a dot |
|
|
| Groups by two with a dash |
| (empty) |
| Adds text around the number |
| (empty) |
| Quotes print |
Example: format a price from a website
The product page shows $1,699. You need $1,699.00 in the email.
Open the rule panel for the price field and paste the price selector into Selector.
Click + Expression. Set Expression to
[^0-9.], leave Replace empty, and select Global. The value becomes1699.Click + Format. Set Format to
'$'#,##0.00and Separator to,.Click Check Rule and Save.
You'll know it worked when the price in the card shows $1,699.00.
Important to note: if the site uses a comma for decimals (for example, 1.699,99 €), [^0-9.] breaks the number. [CHECK: supported pattern for a decimal comma]
Nice, your prices now match the format of your brand. Next: fill cards from a list you already keep with a Data Source.
Related articles
[ADD RELATED ARTICLE]
Thank you for taking the time to read our articles. We hope you will find this information helpful.
If you have any additional questions, please email us at support@stripo.email.
We would be glad to talk with you.





