Skip to main content

Introduction to Regular Expression


What is a regular expression

Regular expressions provide a powerful, flexible, and efficient way to process text. It helps users parse the content of text fields to ensure that the content matches predefined formats such as email addresses, usernames, etc.

Usage

Scenario:
The customer information table has the customer's WeChat account. WeChat accounts are not allowed to have Chinese characters, only letters and numbers. You can qualify the input with custom rules.

1. Configuration

Regular expressions are only available in the text field, check [Limit input format] to start the configuration.

On the left side, you can select the commonly used expressions, or modify them to custom expressions based on the provided expressions (custom expressions cannot be saved to the commonly used expressions on the left side).

Depending on the scenario, we select [letter and number] on the left.

After the configuration is complete, click [Confirm] and save the form.

2. Function

  • Regular expression
    Edit the expression you need here, no spaces at the beginning, and pay attention to whether there are spaces when copying the expression from outside.

  • Prompt for errors
    When the input content is not satisfied, it will prompt the user with the content here. For example, the prompt in the picture is "Please enter letters and numbers", we can just change it to "Chinese characters are not allowed, only letters and numbers are supported".

  • Test
    Enter something to test if the expression and error message meet your needs.

3. Test

Submit a form for testing, as shown below.

Learning recommendations

  • Recommended sites for learning regular expressions https://www.runoob.com/regexp/regexp-syntax

  • More help
    If you are currently unable to write your own expressions, you can post in the community for help.
    Community: https://bbs.mingdao.net
    Posting rules: Choose [Q&A] as the type and add the tag of "regular expressions", as follows.


Have questions about this article? Send us feedback