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 / how to extract string ...
Power Apps
Answered

how to extract string from text label in gallery

(0) ShareShare
ReportReport
Posted on by 130

Hi Powerapps Community,

 

I have text label in gallery which takes data from a column(sharepoint), I want to extract a specific string from this text label.

For example : the text label can be :

1. Nursery(Level 3):Total Kits:5
-------------------------
Nursery(Level 3):Shorts:Size:11:Qty:5:KitFee:6500
Total Amount:32500
*************************
PlayGroup(Level 2):Total Kits:5
-------------------------

 

2. PlayGroup(Level 2):Kits:1

 

 

3.PlayGroup(Level 2):Kits:1:KitFees:5500:
UKG(Level 5):Kits:7:KitFees:5500:

 

so I want to extract number of kits from PlayGroup class , there are 3 scenarios from 1st option starting delimitor = "PlayGroup(Level 2):Total Kits:" and last demilitor is "-" . Just like I pick text between two delimitors(5), I want to pick same text from other 2 options because data reside in column in sharepoint is in different manner. The delimiter in other two options are "PlayGroup(Level 2):Kits:" and " "(space) ,from 3rd: "PlayGroup(Level 2):Kits:" and ":".

I used this formula but it works only for one of the option:
With(
{
wFirst:
Last(
FirstN(
Split(
ThisItem.ClassOrdered,
"PlayGroup(Level 2):Total Kits:"
),
2
)
).Value
},
Left(
wFirst,
Find(
"-",
wFirst
)-1
)
)

The above formula is working only for 1st option , I used || operator after 1st with() function but it returned false not a number. 
Then I used || for find function but still it returned irregular results.


I would appreciate any response.

Regards,

R

Categories:
  • Verified answer
    v-jefferni Profile Picture
    Microsoft Employee on at

    Hi @r_voyager ,

     

    You can use regular expressions to achieve your need:

    vjefferni_0-1688629613113.png

    Last(
     Split(
     Match(
     ClassOrdered,
     "PlayGroup\(Level 2\):(\p{L}*\s*)Kits:(\d)"
     ).FullMatch,
     ":"
     )
    ).Value

     

    Best regards,

  • r_voyager Profile Picture
    130 on at

    Hi @v-jefferni 

     

    Thankyou for the response.

    I tried this and found that it is working fine when kits are less than 10 but if kits are more than 9 than its returning only the first digit.

    playg.PNG

     

    In the screenshot above, the marked row has actually 15 kits and its returning only the first digit. 

    Below is the actual text for first row.

    PlayGroup(Level 2):Kits:15:KitFees:5500:
    Nursery(Level 3):Kits:23:KitFees:5500:
    LKG(Level 4):Kits:12:KitFees:5500:
    UKG(Level 5):Kits:5:KitFees:5500:

     

    I guess it can be acheived by modifying the formula, I don't know much about regex so if you can look into this that would be really helpful.

    Regards,

    R

  • r_voyager Profile Picture
    130 on at

    Okay so I figured it out , I used 

    Last(
    Split(
    Match(
    ThisItem.ClassOrdered,
    "PlayGroup\(Level 2\):(\p{L}*\s*)Kits:(\d{1,2})"
    ).FullMatch,
    ":"
    )
    ).Value

    It worked.

    Thanks @v-jefferni for helping.

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

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 381 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 340

#3
WarrenBelz Profile Picture

WarrenBelz 187 Most Valuable Professional

Last 30 days Overall leaderboard