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 / Field validation formu...
Power Apps
Answered

Field validation formula for numbers and special characters, exclude alpha characters

(0) ShareShare
ReportReport
Posted on by 14

Hello. I'm trying to write a validation formula for a field that should only accept numbers (0-9) and these special characters ("$", "%", ",", "."). Could someone please advise me on how I could exclude alpha characters from the field? There is no expected number of characters for the text entered into the field. I just want to prevent people from adding alpha character text narrative. The field needs to be restricted to numbers only, but has to be able to accept currency, percentages, integers, and floats. I believe I should be using the IsMatch function, but I'm unsure of the full expression. 

 

Here's what I have, but it's not working. 

If(IsMatch(DataCardValue4.Text,"^([a-zA-Z])$"),false,true)

Categories:
I have the same question (0)
  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi,

     

    Can you describe what is not working?

     

    Having a quick look at the formula, it seems to be reversing the result: In case the IsMatch returns a true, the If returns a false. Given that IsMatch returns a boolean on its own, there's no need for the If function, so you can try:

     

    IsMatch(TextInput10.Text,"^[0-9$%,.]+$")
  • mhurston Profile Picture
    14 on at

    Hi. Thanks for your help. It keeps saying there's an error in the formula for data type:boolean. 

     

    mhurston_0-1659983989047.png

     

  • BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @mhurston ,

     

    Are you sure DataCardValue4 is a text input control? Also, what property are you trying to set?

  • mhurston Profile Picture
    14 on at

    Hi. @BCBuizer. This is my 1st powerapp, so I'm a novice, but I believe datacardvalue4 is text input control. I'm trying to set the default data property. 

     

    mhurston_0-1659986663735.png

  • Verified answer
    BCBuizer Profile Picture
    22,505 Super User 2025 Season 2 on at

    Hi @mhurston ,

     

    Unfortunately the Default property is not meant for input validation, but rather to set a default value in case the form is in new mode. 

     

    In this blog you can find an example on how to perform data validation which I hope is useful to you:

     

    https://www.matthewdevaney.com/data-validation-for-power-apps-forms/#Data-Validation-With-Pattern-Matching

  • mhurston Profile Picture
    14 on at

    Thank you so much @BCBuizer. That did the trick for me. I was able to get my field set up. I appreciate you!

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 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard