How to do input validation?

Guys, I'm just learning, please tell me how can I check the input data? I need to check the input data, whether the phone number is correct according to the following parameters:

  • format is "380..."
  • only numbers
  • number length 12 digits

and if the data is correct, then I pass the information to the next process.

Which node can solve this problem? I tried through the switch, but I didn’t get anything :frowning: Tell me where you can at least see examples.

Hi and welcome.

The switch will work if you set a match regex ^380\d{9}$
^startof string
\d any digit
{9} 9 times
$ end of string

1 Like

Thanks a lot!
where should it be written?(
And is it possible to solve this problem in any other way?

In the input field once you select match regex in he dropdown selection box, in the rules section.

Yes many ways, you could do it in a function node with javascript, and there are contrib nodes for validating input/json/xml/etc.
https://flows.nodered.org/search?term=validate