Remove particular words from a string

This is my input string
Udaya Group INVOICE DATE 2022-08-26
vijaynagar AMOUNT DUE $42,652.38
jabalpur, Madhya Pradesh, 482001
India
From here i want to remove invoice date and amount due using string manipulation
and my final output should be like this
Udaya Group
vijaynagar
jabalpur, Madhya Pradesh, 482001
India
Please help

HI,

How about the following?

System.Text.RegularExpressions.Regex.Replace(yourString,"(INVOICE DATE|AMOUNT DUE).*","")

Regards,

Hi @alan.prakash

You can use a Regex.Replace like this:

System.Text.RegularExpressions.Regex.Replace(yourstring, “(INVOICE DATE [\d-]+|AMOUNT DUE [$\d,.]+)”, “”)

Take a look here at the preview

You can start to learn Regex using Regex MegaPost

Cheers

Steve

string.Split({vbLf},StringSplitOptions.RemoveEmptyEntries)

you can use this for split by new lines output is array

and after string_var.replace(array(0).tostring,“”).replace(array(1).tostring,“”)

you can try like this