> For the complete documentation index, see [llms.txt](https://docs.realmacsoftware.com/elements-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.realmacsoftware.com/elements-docs/elements-language/component/properties-json/regular-expressions.md).

# Regular Expressions

RegEx (Regular Expression) is a powerful tool for searching, matching, and manipulating text based on specific patterns. It uses a combination of characters, meta-characters, and quantifiers to define complex search criteria. RegEx is widely used in programming, text editors, and command-line tools for tasks like input validation, pattern extraction, and string replacement. Its versatility allows users to efficiently find and process text, from simple matches to intricate parsing operations.

In Elements it can be used to conditionally check for values. The following example checks a coupon code format before showing a discount slider.

```json
{
  "groups": [{
    "title": "Coupon Settings",
    "properties": [{
      "title": "Coupon Code",
      "id": "couponCode",
      "text": {
        "default": "SAVE10",
        "subtitle": "Use SAVE10, SAVE20, etc."
      }
    }, {
      "visible": "couponCode matches /^SAVE[0-9]{2}$/",
      "title": "Discount",
      "id": "discountPercent",
      "format": "{{value}}%",
      "slider": {
        "default": 10,
        "min": 0,
        "max": 50,
        "round": true,
        "units": "%"
      }
    }]
  }]
}
```

{% embed url="<https://share.cleanshot.com/fTrDTMb6>" %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.realmacsoftware.com/elements-docs/elements-language/component/properties-json/regular-expressions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
