How to get certain data from a user's message

User Data without unnecessary text can be written to variables using Fork. This method will help to separate the text from another data type if the user sends additional text that we do not need along with the necessary information such as email, phone, link in one message. After that, you can continue working with the selected data — output them to text, transfer them to a table, etc.

How to get an email from a user message

1. Add Fork to the screen.

2. Add Fork Target.

3. Specify Regular Expression in the data type.

4. In the regular expression value, add a regular expression that skips only the desired data type. In our case, this is an email:

([a-z0-9_\.-]+)@([a-z0-9_\.-]+)\.([a-z\.]{2,6})

5. Add the i flag so that the regular expression skips small and large letters.

6. If the scenario requires, select the screen for the user to navigate to.

7. Click the Show button.

8. Specify an arbitrary variable name. In our case, the variable is called UsMail_match

9. Add a new variable value:

{{\match}}

The email can be output to the text: {{get UsMail_match 0}}, where UsMail_match is the name of your variable

How to get a link from a user message

1. Add Fork to the screen.

2. Add Fork Target.

3. Specify Regular Expression in the data type.

4. In the value of the regular expression, add a regular expression that skips only the desired data type. In our case, this is a link:

((http|https):\/\/[^\s]+)

5. Add the i flag so that the regular expression skips small and large letters.

6. If the script requires, select the screen for the user to navigate to.

7. Click the Show button.

8. Specify an arbitrary variable name. In our case, the variable is called link_match

9. Add a new variable value:

{{\match}}

The link can be output to the text: {{get link_match 1}}, where link_match is the name of your variable.

How to get a phone number from a user message

1. Add Fork to the screen.

2. Add Fork Target.

3. Specify a Regular Expression in the data type.

4. In the value of the regular expression, add a regular expression that skips only the desired data type. In our case, this is a phone number:

(([+]7)|8)([(-\s]{0,1}\d[)-\s]{0,1}){10}

5. If the script requires, select the screen for the user to navigate to.

6. Click the Show button.

7. Specify an arbitrary variable name. In our case, the variable is called Usp_match

8. Add a new variable value:

{{\match}}

The phone number can be output in text: {{get UsPh_match 0}}, where UsPh_match is the name of your variable.

To the beginning ↑