How do I use { character in label text?

I want to use {foo} in a label text on a screen. However, if I do this, I get an error saying a brace should be followed by another brace or by a number. So how do I escape { in label text?
3 answers

The Label widget allows you to use Braces, the Text widget doesn't.


it's a bug (so file a ticket), was also in a version a couple of releases ago with the signs < or > on a button (fixed in the recent modeler versions)

for that I wrote a little hacky dirty javascipt replacement in a HTML snippet, the button has the class gt:

var $this = $(this);
var t = $this.text();
$this.html(t.replace(/&lt;/g, '<').replace(/&gt;/g, '>') );


maybe this widget is even better to use so you can skip the timeout part above:


In some cases, you can escape a character by the exact same character. Two examples:

Example 1
If you want to use the isMatch function to check if , it requires the following syntax


Now if you would want to check for a single quote in a string, you’ll need to escape that single quote with another single quote.


Example 2

If you want to use braces in a label or caption, make sure that you escape the left brace with another left brace. The resulting in error already explains this (at least in Mendix 7).

Brace should be followed by a number of digits or another brace.

The right brace doesn’t need escaping.