When using a Forms template with a field set for Field Scripting or Static Text, you can use the VB Script command replaceregex() to match and replace field input text in the template. Regular expressions have backreferences, which return the text matched by the regular expression. Backreferences can be used in the replace option of the replaceregex() function to return the text matched from the function.
Not all variations of backreferences are supported in eDocBuilder regular expressions. The example statements below use a regular expression that matches all the text in the input field from beginning to end, written as ^.*$ in the expression, and then use a back reference enclosed in a font tag with a color attribute to change the color of the input text in the template.
The backreferences $& and $0 will work in eDocBuilder regular expressions, but backreferences like $1 and $MATCH will not work. If you copy any statements below to use in your own template, be sure to change the field name inputField to be the name of the input field on your template.
Backreferences like these will work:
replaceregex(inputField,"^.*$","<font color='Red'>$&</font>")
replaceregex(inputField,"^.*$","<font color='Red'>$0</font>")
Backreferences like these will NOT work:
replaceregex(inputField,"^.*$","<font color='Red'>$1</font>")
replaceregex(inputField,"^.*$","<font color='Red'>$MATCH</font>")
Note that VB Script is supported in Forms templates in eDocBuilder, but will not work in Interactive Designer templates.
For more information on backreferences in regular expressions, this site is a good reference:
For more information on VB Script in eDocBuilder, please refer to this article: