# Regex Add/Update

To ensure users provide valid Order IDs or mobile numbers, we use **regex-based validations**. Below is a step-by-step guide on how to check and modify the regex patterns currently in use:

***

### Steps to Check and Modify the Regex:

1. **Access Entity Management:**
   * Visit [Entity Management](https://limechat.retool.com/apps/5d41b054-e263-11ec-bfa7-53452463a643/Entity%20Management\(Internal\)).
2. **Select the Relevant Company:**
   * Navigate to the **"Company Centric"** tab.
   * Select the appropriate **Company** and allow the data to load.
3. **View Current Regex:**
   * Under **entities\_custom**, click on **"root"** to expand the entity details.
   * Locate the fields where regex patterns for **Order ID** and **Mobile Number** are configured.
4. **Modify the Regex if Required:**
   * Click on **"Modify Slot"** to update the regex pattern.
   * You can generate new regex using tools like **ChatGPT** based on sample orders or numbers.
   * Validate any new regex patterns using [Regex101](https://regex101.com/) to ensure correctness.

***

### Dual Validation Setup: Order ID or Mobile Number

* The system is configured to **accept and validate input using two types of regex**:
  * **Order ID Regex**: To detect valid order ID formats (e.g., purely numeric, alphanumeric with prefixes like "ORD12345", etc.).
  * **Mobile Number Regex**: To validate standard 10-digit mobile numbers.
* If a user enters either a valid order ID **or** a valid mobile number, the system will proceed accordingly based on the matched regex.

**Important:** Both regex patterns must be kept updated to avoid blocking valid user inputs during support interactions.

***

### Example for Reference:

| Example Type | Input Example          | Notes                                        |
| ------------ | ---------------------- | -------------------------------------------- |
| Order ID     | 45678, ORD12345, A7890 | Should match numeric or alphanumeric formats |
| Mobile No.   | 9876543210             | Should validate 10-digit mobile numbers      |

**Explanation:**

* Order IDs can vary between numeric, alphanumeric, or prefixed formats depending on the brand.
* Mobile numbers are typically expected to be a 10-digit sequence without any country code prefix unless specified.
