Hi All,
I need to split a string “3057020000325199:MATM 1215091318561170300132”
from the above expression I just need “121509131856” i mean I just need to consider
12 number after"MATM" no need to consider before MATM.
Please help me on this.
Thanks
Hi @HeartCatcher
Try Splitting By Space and Take Index 1 value from Split and SubString(0,12) will Provide the result.
sttingValue is the Input String
Regards
1 Like
ppr
(Peter Preuss)
September 16, 2021, 11:27am
3
myString = System.Text.RegularExpressions.Regex.Match(YourStringVar, "(?<=MATM )\d{12}").toString
2 Likes
Palaniyappan
(Palaniyappan P )
September 16, 2021, 11:38am
4
Hi
It’s the same way how we used a split method in your previous query
Here instead of space we will use MATM as a separator
Like this
Str_output = Split(Str_input.ToString,”MATM”)(1).ToString.SubString(0,12)
Here MATM is considered as a separator and in Substring 0 represent the first character and 12 will consider the first twelve letters from 0 position
It’s as simple as that
Cheers @HeartCatcher
2 Likes
takyysh
(Takyysh)
September 16, 2021, 11:50am
5
HeartCatcher:
121509131856
hi ,
(str) Str1=“3057020000325199:MATM 1215091318561170300132”
(int32) StrLenght=Str1.length
(int32) int1=Str1.indexOf(“MATM”)
Str2=Str1.Substring(Int1+4,length-(Int1+4))
Charbel1
(Charbel)
September 16, 2021, 12:12pm
6
Hello @ppr ,
Can you please explain how (?<= ) works?
Thanks
ppr
(Peter Preuss)
September 16, 2021, 12:17pm
7
got explained from Regex101.com with
1 Like
hii
you can try like this
Hi @HeartCatcher
Is this resolved
Hi @Palaniyappan ,
It Does Work thanks for your contribution.
1 Like
system
(system)
Closed
September 20, 2021, 3:45am
15
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.