Split all the text available before second space

Input text 1 : [0001] HMP Direct Electronics - EU

Expected output : [0001] HMP

Input text 2 : [0001] HCP Do not use - Einkaufsorg. 0001

Expected output : [0001] HCP

@Sathish_Kumar_S

System.Text.RegularExpressions.Regex.Matches(InputText,“[\d+]\s[A-Z]+”)

Hi @Sathish_Kumar_S
Use this below syntax:

strinput1= "[0001] HMP Direct Electronics - EU"
output1= System.Text.RegularExpressions.Regex.Match(strinput1,"\[\d+\]\s*[A-Z]+").Value

strinput2= "[0001] HCP Do not use - Einkaufsorg. 0001"
output2= System.Text.RegularExpressions.Regex.Match(strinput2,"\[\d+\]\s*[A-Z]+").Value

Hope it helps!!

1 Like

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