<metaproperty="description"content="Some methods require the client to verify if the data obtained from an external source matches a certain pattern.">
<metaproperty="og:description"content="Some methods require the client to verify if the data obtained from an external source matches a certain pattern.">
<divid="dev_page_content"><p>Some methods require the client to verify if the data obtained from an external source matches a certain pattern.</p>
<p>For example, when <ahref="/api/auth">requesting a login code</a>, if the chosen verification method is a <ahref="/constructor/auth.sentCodeTypeFlashCall">flash call</a>, it is required that the phone number (which is the login code) matches the specified pattern.</p>
<p>Same with <ahref="/constructor/account.sentEmailCode">email verification codes</a>.</p>
<p>In all cases, the pattern is a string of the same length as the string to verify: and matching is as simple as checking if all chars in the source string are the same as in the pattern string.
Some chars in the pattern string may be censored using an asterisk <code>*</code>, in this case any char in the source string is considered valid.</p>
<p>The pattern string can also be a single asterisk, in this case all patterns are considered valid.</p>
<p>If the source string is a phone number, it has to be sanitized first to include only the following chars: <code>0123456789</code>.</p>
<p>Example implementation: <ahref="https://github.com/DrKLO/Telegram/blob/9ffc7787d6ed4386363fad001334ae411c2877d9/TMessagesProj/src/main/java/org/telegram/messenger/AndroidUtilities.java#L1341">telegram for android</a>.</p></div>