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 / Search Char and Colour...
Power Apps
Answered

Search Char and Colour the whole word?

(0) ShareShare
ReportReport
Posted on by 997

Hello,

Some while ago i got this great code to colour a part of the text

I like to change it now with a custom part

I have a separated label and i add lets say J

And the name will colour Label13_3 where the J is located or any other Char.

 

With(
 {
 wMessage: 
 Split(Label13_3," ")
 },
 "<html><head>
 <meta charset='utf-8' />
 </head>
 <body><b>" & 
 First(wMessage).Result & " " & 
 "<b style='background-color:#68FF00;'>" & Index(wMessage,2).Result & "</b>" & " " & 
 Index(wMessage,3).Result & " " & 
 Index(wMessage,4).Result & " " & 
 Index(wMessage,5).Result & "</b>
 </body></html>"
)

 

So lets say the sample here is John Doe

The above code will colour Doe

And i want to change it with J from the separated label

So how can i make the code colour this part instead so it will always looks for the first part of any word after a space that's contains J or any char i have added?

Thank you.

 

Categories:
I have the same question (0)
  • Verified answer
    TheRobRush Profile Picture
    11,128 Moderator on at

    Make a text input, in my example it is named

     

    TextInput1

     

     

    Place a label with example text in it to the left of the screen. I set it's text for our example to

     

    "Whether the weather be fine,
    Or whether the weather be not,
    Whether the weather be cold,
    Or whether the weather be hot,
    We’ll weather the weather,
    Whatever the weather,
    Whether we like it or not."

     

     

    Now on the right of our screen I place an html text box, it's htmltext is set to

     

     "<html>
     <body>
     <div align=center>" &
    Concat(
    ForAll( 
     Split(Label13_3, " ") As inFocus, 
     If(
     Len(TextInput1.Text)=0, inFocus.Result,
     Upper(Left(inFocus.Result,Len(TextInput1.Text)))=Upper(TextInput1.Text),
     "<font style='background-color:#68FF00; font-weight:bold;'>" &inFocus.Result& "</font>" , 
     inFocus.Result)), 
     ThisRecord.Value, " ")
     
     &"</div></body></html>"

     

     

    In this example you can use the text input to search for words, by typing into it. if you type w it highlights everything that starts with a w like so

    TheRobRush_0-1676051498427.png

    furthermore if you add another letter it will narrow further, for example i type a wh and i get the following highlighted.

    TheRobRush_1-1676051553983.png

    to change it to 1 letter only you will need to just chaneg the

     

    Len(TextInput1.Text)

     

    in the 

    Upper(Left(inFocus.Result,Len(TextInput1.Text)))=Upper(TextInput1.Text)

    statement to 1, if you do that however be sure to limit their text input to 1 character only

     

     

  • TimmyBoy Profile Picture
    997 on at

    @TheRobRush 

    Omg, you are so amazing,

    Thank you so much for this solution

    Just what i needed 😉

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
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard