Highlighting a specific text with any color

This code is showing error

hello @Priyesh_Shetty1


for this type
YourString = “ this is the trext and something (PAN - GWMSK1234J) and this pan is something fake.
YourPanNumber = Regex.Match(YourString,“(?<=PAN.-).[A-Z 0-9]{10}”).Value
YourString = YourString.replace(yourpannom,“<span style=”+“”“color:red;”“”+“>”+yourpannom+“”)

if regex activity gives error please import it as per screenshot
image

Hope thiswill solve your issue.

@Shubham_Kinge i used ur method but it is not getting highlighted…I want like this i have sended you in the above image…only PAN should get highlighted…in the mail body

Pan wrritten style changed thats why it came like that.
YourPanNumber = Regex.Match(YourString,“[A-Z]{5}[0-9]{4}[A-Z]{1}”).Value

Provide this one and try
@Priyesh_Shetty1

Bro still my issue is not solved

YourPanNumber = Regex.Match(YourString,“[A-Z]{5}[0-9]{4}[A-Z]{1}”).Value
This should be the solution. what is error are you getting

Bro i want the output like above img…In this case user will run the bot 2 times a day and basically bot will download multiple pdf’s extract that pdf’s and then it will convert that extracted pdf’s in txt file, after that bot will append all the extracted pdf’s in mail body and in some text (PAN:JECPS8***) Pan no is written and in some text Pan is not mentioned…I just wanted to highlight that PAN-JECPS8******.

@Shubham_Kinge iam not getting the ouput it is showing color:red it is showing ouput like this

SendingRedColorPan.xaml (10.8 KB)
See this code

@Shubham_Kinge Showing error in assign

it is because Pan card may be in lower case or something. can you provide what type of pan numbers you are getting. styles not real pan like
KSJDK1234K
kkdjs1111k
KkKk2313j
Like thins?
cause i sent regex for Just matching Upper case 5A-Z then 4 0-9 and 1 upper case Word
[A-Z a-z]{5}[0-9]{4}[a-z A-Z]{1} provide this for above examples

It is in upper case only

Bro again i got the same error

[A-Z a-z]{5}[0-9]{4}[a-z A-Z]{1} after using this also i got the same error

okay then try this one.
[A-Z]{5}[0-9]{4}[A-Z]{1}|[A-Z]{5}[0-9 A-Z]{5}
because pan having one last Alphabate not number thats why error came