Please help to do extract the values from below example texts
Text 1 :CA- - Plant 4001 - CoCode 4001
Need text available after CoCode
Expected output : 4001
Text 2 : [4001] HCS Inc USA
Value Inside [ * ] bracket
Expected output : 4001
Text 3 : [PIND] HMP Indirect Procurement Ariba
Value Inside [ * ] bracket
Expected output : PIND
1 Like
Stroutput = Split(Strinput.ToString, βCoCodeβ)(1).ToString.Trim
stroutput = System.Text.RegularExpressions.Regex.Match(Strinput.ToString, β\[(.*?)\]β).Groups(β1β).Value
Same as above
Explanation
Cheers @Sathish_Kumar_S
1 Like
supriya117
(Supriya Allada)
3
Hi @Sathish_Kumar_S
Matches1 = System.Text.RegularExpressions.Regex.Match(βCA- - Plant 4001 - CoCode 4001β, β(?<=CoCode\s+)\d+β).Value

Matches2 = System.Text.RegularExpressions.Regex.Match(" [4001] HCS Inc USA", β(?<=[)\d+β).Value

Matches2 = System.Text.RegularExpressions.Regex.Match(" [PIND] HMP Indirect Procurement Ariba", β(?<=[)[A-Z]+β).Value

1 Like
Anil_G
(Anil Gorthi)
4
@Sathish_Kumar_S
Please try these
Str.Split({"CoCode"},Stringsplitoptions.None)(1)
Str.Split({"[","]"},3,Stringsplitoptions.None)(1)
Or using regex
(?<=CoCode\s*).*
(?<=\[).*(?=\])
Cheers
1 Like
Hope itβs clarified @Sathish_Kumar_S
1 Like
system
(system)
Closed
7
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.