URL Parameter Regular ExpressionsThis document describes the setting "URL parameter regular expression". This setting is available in the Behavior Editor / Settings / General Options. PurposeThere are some scenarios where a user reaches the site using an url, typically a form of DirectURL where part of the DirectURL is an unknown value, and you want to capture this value in a form field. This setting allows you to define an regular expression to parse the URL, and store the value in a variable that can be used in a field. Example:Assume that we have a DirectURL defined that will bring all requests of the url: www.example.com/abc/123/xyz to a particular target page, but where xyz could be any set of letters In this case we want to store the final set of letters (eg 'xyz') in our field. To make the case more interesting, the 123 part is also variable, so our regular expression needs to handle that, but match the xyz part for our field. Configure a regular expression for this setting with: Pattern: abc/\d+/(.*) Return (x) Input replaced with: $1 Then, you can embed a Data Entry Form or Sale View on the page, and for any field that accepts a Default value, enter as the default: %url[1] When the page is visited, the field will then be given the value retrieved by the regular expression. |