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 / IsMatch function with ...
Power Apps
Answered

IsMatch function with pattern (Optional Comma & Space)

(0) ShareShare
ReportReport
Posted on by 47

Hi Experts,

I would like to seek your assistance on the validation syntax for an "IsMatch" function.

  • This is a text input field.
  • The user should be able to input a minimum of one 7-digit number (or) multiple 7-digit numbers [separated by a comma & a space
  • Scenario1: one 7-digit number [8000000]
  • Scenario2: multiple 7-digit numbers [8000000, 8000001, 8000002, 8000003, 8000004]

Here is my formula,

IsMatch(
 TextInput2.Text,
 "\d{7}\,*\s*",
 MatchOptions.BeginsWith
)

This does not seem to be working, please assist. Thank you. 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    154,795 Most Valuable Professional on at

    Hi @Franklin_vaz ,

    Best effort below (did my head in a bit, but seems to work on test model)

    With(
     {
     wText: 
     Substitute(
     TextInput2.Text,
     " ",
     ""
     )
     },
     If(
     Find(
     ",",
     wText
     ) = 0,
     IsMatch(
     wText,
     Digit & Digit & Digit & Digit & Digit & Digit & Digit
     ),
     With(
     {
     wStrings: 
     Split(
     wText,
     ","
     )
     },
     CountRows(
     Filter(
     wStrings,
     IsMatch(
     Result,
     Digit & Digit & Digit & Digit & Digit & Digit & Digit
     )
     )
     ) = CountRows(wStrings)
     )
     )
    )

     

    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.

    Visit my blog Practical Power Apps

     

  • Franklin_vaz Profile Picture
    47 on at

    Many thanks, @WarrenBelz for your quick response.

     

    Validation works, and I can understand your logic.

    Here is some feedback,

    • The validation returns "true" even if there is no space
    • But it ensures each number is 7 digits and is separated by a comma at least
    • ignoring if a space is given or not.

    Curious to ask; the test you did, was it the same case? 

  • WarrenBelz Profile Picture
    154,795 Most Valuable Professional on at

    Hi @Franklin_vaz ,

    The replacement of the space was "in case" one was put in as if I did not clean it up, the Split() parts could contain a space and therefore not pass validation, so yes, the results of your three points were intentional.

     

    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.

    Visit my blog Practical Power Apps

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 505

#2
WarrenBelz Profile Picture

WarrenBelz 502 Most Valuable Professional

#3
Haque Profile Picture

Haque 324

Last 30 days Overall leaderboard