List input text pattern validation

Hi Guys

Good day!

How do I structure a syntax using .ConsistOf(“”) If I want to validate check the entered text must be in this pattern “Restless, John”?

Is this possible?

Thanks!

  1. No. And not because .ConsistsOf() has nothing to do with this check. But because your pattern is fundamentally uncheckable. To the extent that I can see you want the lastname followed by the firstname:
    “Smith, John”. But this relies on some understanding of what is the first (“John”) and the last (“Smith”) names are. Clearly this is not generalizable and not reliable, with some obvious situations when this distinction can’t be made, as clearly, both “Gregory, John” and “John, Gregory” exist:

  2. If you know (from a separate entry) what the first name is and what the last name is, then you can do the check:

self==lastname + ", " + firstname

But:

  • if you don’t have a separate input, then you just have to trust the user.
  • On the other hand, if you already have a first and last name separately, why would you ask the respondent to enter the fullname [again]?
  1. Requiring people to have BOTH firstname and lastname is a rather strong requirement in some circumstances. See mononym. Check if that matters here.

Hope this helps, Sergiy

Hi sergiy

Thanks for you response but basically, we just want to show an error message if the entered text doesn’t have “,” between the two text.

But it’s all good now

That is a different question. If you don’t care about the pattern, but only about the presence of a comma, then use .Contains() as shown here:

Clearly this will pass even with obviously wrong entries, like a comma by itself: “,”. So I’d recommend to have other checks precluding such invalid entries.