String get fix out put

hello All,

need help to below string need to split
“NO PRETICKET XCLUB 4727X DC N XORDER 10051887673 XMEMBER NBR 0000957485683 XMEMBER NAME LAMONT LOCUST XSHIP TO NAME LAMONT LOCUST XSHIP TO ADDR1 429 CHALFONT ST XSHIP TO CITY PITTSBURGH XSHIP TO STATE PA XSHIP TO ZIP-CODE 15210 XSHIP TO COUNTRY US XSHIP TO PHONE 4439911287 XSHIP PT ADDR1 529 5TH AVE FL XSHIP PT ADDR2 FLOOR 18 XSHIP PT CITY NEW YORK XSHIP PT STATE NY XSHIP PT ZIP-CODE 10017 XSHIP PT COUNTRY US XSHIP PT PHONE 855-458-5885”

above String split from “XSHIP TO NAME” and i want “LAMONT LOCUST” name only
next split from "XSHIP TO ADDR1 " and i want “429 CHALFONT ST”
next split from “XSHIP TO CITY” and i want “PITTSBURGH”

above spliting is possible?
advance thank you

Hi @Ram_Gurav1 ,

Not so sure if you would require the splitted data also, but the values I believe that you want to extract could be done using the below regex :

  1. XSHIP to NAME value :
(?<=XSHIP TO NAME).*?(?=XSHIP)

Expression :

System.Text.RegularExpressions.Regex.Match(yourInputVar,"(?<=XSHIP TO NAME).*?(?=XSHIP)").Value.Trim
  1. XSHIP to ADDR1
(?<=XSHIP TO ADDR1).*?(?=XSHIP)

Expression :

System.Text.RegularExpressions.Regex.Match(yourInputVar,"(?<=XSHIP TO ADDR1).*?(?=XSHIP)").Value.Trim
  1. XSHIP to CITY
(?<=XSHIP TO CITY).*?(?=XSHIP)

Expression :

System.Text.RegularExpressions.Regex.Match(yourInputVar,"(?<=XSHIP TO CITY).*?(?=XSHIP)").Value.Trim

Let us know if this is not what you required.

thank for quick reply its work

1 Like

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