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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / validation text input
Power Apps
Answered

validation text input

(0) ShareShare
ReportReport
Posted on by 418

Hi, any idea how do I create formula to control input as below format? The button only will enable to submit once meet this format..

 

First 3 character must be alphabet

And next is number (7 digit)

 

Format:

ABC5345346
ABC7457755

 

Thanks

Categories:
  • Verified answer
    RusselThomas Profile Picture
    4,014 on at

    Hi @twister ,

    You can use RegEx (Regular Expression) notation with one of the Match/MatchAll/IsMatch functions to match a pattern and manage the control behaviour that way - for example set the border color red, or set the submit button disabled/enabled depending on whether there is a match.

    Try this on your button DisplayMode: property

     

     

    If(
     IsMatch( TextInput1.Text, Letter & Letter & Letter & Digit & "{7}"),
     DisplayMode.Edit,
     DisplayMode.Disabled
    )

     

     

    You can read more about regex syntax but it's a pretty abnormal kind of construct (unless you use linux and things like grep a lot 😁) - I certainly can't use it without reading up every time and using trial and error.

     

    PowerApps tries to simplify it for you by replacing expressions with easier to read words like Digit and Letter - but you can use the more traditional (and harder to understand) syntax for more complex patterns.  To demonstrate how you can use both methods in the same pattern, instead of repeating & Digit seven times above, I just dropped into the standard syntax and added "{7}" which is a quantifier expression for "the previous expression {n} times".  I could also just have used

     

    Letter & "{3}" & Digit & "{7}"

     

    or some actual syntax (which I'm sure someone else can refine further or improve upon)

     

    "[a-z]{3}\d{7}"

     

     

    If you need to ensure it's uppercase, rather than forcing the user to retype it with a match and error, just convert it with Upper(TextInput.Text).

     

    Hope this helps,


    RT

  • twister Profile Picture
    418 on at

    for my case.. resolved by using this formula.. thanks..

     

    If(
     IsMatch( TextInput1.Text, Letter & Letter & Letter & Digit & "{7}"),
     DisplayMode.Edit,
     DisplayMode.Disabled
    )

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 409 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 328

#3
WarrenBelz Profile Picture

WarrenBelz 252 Most Valuable Professional

Last 30 days Overall leaderboard