Search:  

URL Parameter Regular Expressions

This document describes the setting "URL parameter regular expression".

This setting is available in the Behavior Editor / Settings / General Options.

Purpose

There 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 to insert into field. These values may be inserted into the following fields:

  • Sale view text fields
  • Log-in component access code fields

To use this setting you define a regular expression to parse the URL, and store the value in a variable that can be then used in the 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 lowercase 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 a variable set of integers, so our regular expression needs to handle that, but also match the xyz part for our field.

Configure a regular expression for this setting with:

Pattern: abc/\d+/([a-z]+).*

Return (x) Input replaced with: $1

Then, in the field to be populated, enter as the default:

%url[1]

When the page is visited, the field will then be given the value retrieved by the regular expression.

 

Copyright © 2023 Enstar LLC    All rights reserved Print this pageTranslate: