Strip Formatting
Formatted Text type variables are variables that a shopper can format (for example, change the font type, color, size, etc.) and these need to be stripped of their formatting if you want to use them in another variable which is not in a text frame. This is because all variables are enclosed in XML formatting that can interfere with the new variable. A typical example of this is the re-use of variable values in barcodes. The formatting is stripped using a Calculated Field type variable with an action that includes a regular expression to strip the formatting and only return the value of the variable. Your form can be set up so that the shopper does not see the calculated form fields.
Summary
In the following example, a QR code is generated which includes a company URL that the shopper can format for its original position on a business card. This text variable is called Company_URL and the shopper can change the color and font size as required, for example to make it larger if the URL text is short, or change the color so it stands out. To insert this URL in a QR code, a new calculated field variable, called Company URL_TXT is created. This variable is based on the first variable and set up so it is not visible on the form.
Action type: Value calculation (In the Actions tab, edit Value calculation.)
Variable type: Calculated Field
Document with Formatted Text variable set to Visible: Company_URL
Regular expressions used in the action code for the regexp string to strip formatting:
/<[^>]*>/gi
Action code for Company_URL_TXT:
1 return stringFunctions replaceRegExp string variable Company_URL value
regexp: string /<[^>]*>/gi
replace string
Strip formatting from text for use in QR code 
1 In the Forms tab, check that your document has the following variable defined:
Name: Company_URL
Display Name: Company URL
Type: Formatted Text; in the Type Specific tab, enable Font, Font Size, Color, Alignment, so the shopper can modify the formatting.
Visible check box selected
This variable is used in the document.
The intention is to re-use this variable in a QR code, but first we need to create a calculated field version of this variable.
2 In the Forms tab, create a new variable with the following settings:
Name: Company_URL_TXT
Display Name: Company URL TXT
Type: Calculated Field
Visible check box cleared
3 In the Actions tab, click Value: Edit to open the Action Editor, and add a code line.
4 Specify the code line as follows:
1 return stringFunctions replaceRegExp string variable Company_URL value
regexp: string /<[^>]*>/gi
replace string
NOTE: The values after string must be typed in the fields.
5 Click Apply to save your changes.
6 Click Close to finish your variable settings and save the document.
7 Go to the Barcodes tab and add a barcodes frame to the document.
8 In the Type drop-down list, choose QR Code.
9 In the Variable drop-down list, choose your calculated variable: Company_URL_TXT, not the formatted text variable.
10 Specify the settings for the QR code as desired and click Apply.
The QR barcode is placed on the document and includes the URL without formatting to ensure that the URL functions correctly when scanned.
If you selected the unstripped version of the variable, Company_URL, you would see the following code in the value field:
The frame for the QR barcode remains empty because the QR code cannot be generated with this formatted variable.
doc. version 6.0.4