The Checkout Premium app supports the use of Regular Expressions, allowing you to define specific formatting rules for input fields during checkout. A regular expression is a customizable character template or rule that checks if the text a customer enters matches the format you require. This helps standardize input, prevent errors, and create a smoother checkout experience.
If you're not familiar with coding, regular expressions serve as an automatic input checker for fields like mobile phone numbers, tax IDs, and national ID numbers. These rules help improve data accuracy without needing technical knowledge.
This article outlines common scenarios and explains how to use AI tools to generate regular expressions that match your store’s input requirements.
Note
- This article is intended for illustrative purposes. If your actual checkout scenario requires blocking certain formats or enforcing specific validation rules, consult authoritative institutions first to confirm the correct guidelines. This helps prevent accidentally rejecting valid entries.
- Always test AI-generated expressions to ensure they perform correctly before applying them to live checkout fields.
- If you need help using the AI tools referenced in this guide, refer to: AI operation scenarios | How to use DeepSeek?
Verifying mobile phone numbers
Validating phone numbers during checkout reduces communication issues and helps prevent failed orders. Regular expressions allow you to check that phone numbers follow the correct structure before the order is submitted.
- Decide what formats to accept or reject: Start by clearly defining what type of phone number should be considered valid. This may include requirements such as a specific country code, total number of digits, or starting number.
- Generate the expression using an AI tool: After defining your rules, describe them to an AI tool like DeepSeek. Include details such as required digits, formatting, and any special considerations.
- Anticipate real-world formatting quirks: Customers often add spaces to their phone numbers (e.g., + 86 138 0000 0000). Let the AI know that these spaces should be ignored when creating the expression if you plan to allow them.
Note
- Customers may include spaces in the number (e.g., + 86 138 0000 0000). If so, instruct the AI to either allow or ignore spaces accordingly.
Example scenario: Accept only Chinese mainland mobile numbers that:
- Start with +86
- Include 11 digits
- Begin with the digit 1
- Allow spaces between digits
Suggested AI prompt:
"I want to verify Chinese mainland mobile numbers that start with +86, followed by 11 digits starting with 1. Spaces between digits should be ignored."
AI generation example:
After the expression is generated, apply it to the phone number field in your checkout form to ensure invalid entries are automatically blocked.
Verifying tax numbers or ID numbers
International orders often require a tax number or national ID for customs clearance. If customers enter invalid information, their packages may be delayed or blocked by customs.
You can use regular expressions to enforce the correct format before customers complete their purchase.
- Identify the exact format required: Find out how long the number should be and whether it must include only letters, numbers, or a combination. Also note whether the case matters or if special characters are allowed.
- Explain the format to the AI: Give the AI tool a clear description of the format. This will help it create an expression that blocks incorrect input and ensures successful validation.
Example scenario:
The required tax number must:
- Be 13 or 18 characters long
- Contain only letters (any case) and numbers
Suggested AI prompt:
"I want to verify a tax ID that is either 13 or 18 characters long and includes only letters and numbers."
AI generation example:
Paste the generated expression into your checkout field settings for taxID to ensure customers enter the correct format before completing their order.
Using Regular Expressions with the Checkout Premium app helps you create a more accurate and efficient checkout experience. Whether you're verifying contact numbers or important ID fields, combining clear business rules with AI-generated expressions enables you to automate input checks and eliminate manual errors.
Comments
Please sign in to leave a comment.