How to replace specific word using regex

Hello all,

Can anyone please help me…

I want to remove [If Applicable] and my Output should be



Give a try on:
Regex.Replace(strText, “.*(?=2nd Loan Amount)”, String.Empty)

Hi Peter,

Thank you for your reply,

Can you pls tell me how to assign StrText

strText is the variable holding the text simialr to your screenshots

Hi Peter,

I have tried it its not working… Can you pls tell me where i did mistake…

where is the text assigned to a variable where the value is the full text as:

what is its variable name?

Hi Peter,

I can able to remove [If Applicable] but above two lines also removed …

I am getting output as below only one line
2nd Loan Amount: 100,000

Actually i want output should be above two lines also
Purchase Price: 200,000.00
1st Loan Amount: 50,000.00
2nd Loan Amount: 1000

can you try with

yourStringVariable.Replace("[If Applicable]", string.Empty)


have some look here for some trainings:

Thank you so much Peter … Finally got the output

Thank you so much Fernando…

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.