web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / validating if numbers ...
Power Apps
Unanswered

validating if numbers and letters are in a text input

(0) ShareShare
ReportReport
Posted on by 265

Hi,

I want to validate "123801902V" or "201923920v" text filed in a form in the power app .How I do it?

there should be 9 digits and one letter .

Thank you.

Categories:
I have the same question (0)
  • mmbr1606 Profile Picture
    14,605 Super User 2025 Season 2 on at

    hey @Erandi 

     

    is it always the letter V or any letter? what is ypir exact use case? so what happens when the validation is true?

     

  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    HI @Erandi , You can use IsMatch. Check this:

    https://www.matthewdevaney.com/data-validation-for-power-apps-forms/

     

    https://learn.microsoft.com/en-us/power-platform/power-fx/reference/function-ismatch

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • enriqueglopez Profile Picture
    503 Moderator on at

    You can use IsMatch function to compare your input value with a RegEx.

     

    For example:

     

     

    IsMatch(TextInput.Text, "^\d{9}[a-zA-Z]$")

     

     

    This Regex will help to reach what you want. You could do the validation like this:

     

    If(
     IsMatch(
     TextInput.Text,
     "^\d{9}[a-zA-Z]$"
     ),
     "Input is valid",
     "Input is not valid"
    )

     

    Ref: IsMatch, Match, and MatchAll functions - Power Platform | Microsoft Learn

     

    If this post helps, then please consider Accept it as the solution to help the other members find it.

  • Erandi Profile Picture
    265 on at

    Hi @mmbr1606 ,yes it can be "V" and "v". That is a  ID number pattern. So i want validate it when submitting to form.

  • ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    @Erandi Try this

    IsMatch(
     TextInput1.Text,
     Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Letter
    )

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • Erandi Profile Picture
    265 on at

    Hi guys,

    If I use the numbers between 0 to 9, it should be 

    IsMatch(txtNIC.Text, "^\d[0,9][z-Z]$") ,
     
    am i right?
  • Erandi Profile Picture
    265 on at

    hi @enriqueglopez ,

    i tried but i am getting error like this.

    Erandi_0-1704363239954.png

     

  • Verified answer
    enriqueglopez Profile Picture
    503 Moderator on at

    Use this one instead

     

    "^\d{9}[vV]$"

     

     

    This Regex will validate that the first 9 characters are a number and the last is V or v.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it.

     

  • Verified answer
    ANB Profile Picture
    7,223 Super User 2025 Season 2 on at

    @Erandi If last letter will always "V" or "v", this should also help you

     IsMatch(
     TextInput1.Text,
     Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Digit & Match.Letter
     ) && ("V" in TextInput1.Text || "v" in TextInput1.Text)

     

    You can add above thing in the condition.

     

    -----------------------------------------------------------------------------------------------------------------------------

    I hope this helps.

    Please click Accept as solution ✅ if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs up.👍

    Thanks,
    ANB


  • Erandi Profile Picture
    265 on at

    Hi guys,

    then if i want to validate 6 digits long ID.can I use like this?

    If(
            Len(txtEmplID.Text) = 6,
     
            UpdateContext({varShowErrorMsg:"Employee ID contains 6 digits"});
            UpdateContext({varShowError:true});        
            Reset(txtEmplID);
        )  

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 793 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 333 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard