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

Community site session details

Session Id : 5v6XfwdCODHaCHKljbpJzN
Power Apps - Power Apps Pro Dev & ISV
Answered

Regular expression to accept only numeric values along with *

Like (0) ShareShare
ReportReport
Posted on 12 Apr 2021 17:56:46 by 50

Hi, 

 

I have a textbox which should take "*" as default value. Also, it should accept only numeric values up to 1 decimal point and value should not be greater than 100, since it is percentage.

 

Example: Accepted values in Textbox : *, 23.1, 32.1, 100, etc..

Not Accepted : 23.22, 101, etc..

 

Please help me with regular expression or what is the best way to achieve this.

  • Verified answer
    v-xiaochen-msft Profile Picture
    on 13 Apr 2021 at 01:42:48
    Re: Regular expression to accept only numeric values along with *

    Hi @vakula ,

     

    I did a test for you.

    1\ Add a textinput control 'TextInput1' and set its Default property to:

    "*"

     

    Set this textinput control's Onchange property to:

    Set(Thevar,TextInput1.Text);If(IsMatch(Thevar,"^([0-9]|[0-9]\.\d+|[1-9][0-9]|[1-9][0-9]\.\d+|100)$")&&Or(IsBlank(Find(".",Thevar)),Len(Mid(Thevar,Find(".",Thevar)+1))=1),Thevar,Reset(TextInput1))

     

    2\ The result is as follows:

    AAA.gif

    Best Regards,
    Wearsky
    If my post helps, then please consider Accept it as the solution to help others. Thanks.

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for…

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete