# Fuzzy Logic and Regex Locators

On certain dynamic sites, using strict locators is most of the time challenging and also changing. A strict locator is a locator of an element that should match complete an attribute or a text, meaning it should always match ID or class, etc, or with the complete text of the element.

Test Designer offers the use of Fuzzy and Regex Locators which will help in handling any dynamic contents of any web application.

Example:

Below is one example of a dynamic locator where the heading would keep changing.

heading1("Build office's profile")

Edit the recorded step to replace the accessor with the right expected text value, or a portion of it using the square brackets or in Regex

heading1(\["This is a significative portion of the expected text"\]) //This is Fuzzy Logic

or

heading1(/.\*This is a significative portion of the expected text./); // IMPORTANT: Regular Expression SHOULD NOT be enclosed in quotes, otherwise will be treated as a string }}

---

## Choosing a locator strategy

Use a strict locator when the target attribute or text is stable and unique. Use a fuzzy or regular-expression locator when the application generates changing values, but keep the pattern as narrow as possible so it does not match multiple elements.

## Validation

After editing a recorded accessor, replay the step against representative page states and confirm that exactly the intended element is selected. If the pattern matches more than one element, refine the stable portion of the attribute or text.

Last updated: October 15, 2026

If you have any feedback on this topic, please contact us at <documentation@appvance.ai>