Stef_99
(Mary)
1
Hello.
I have value = AAK-20250314-154055-Trik-4-02SAA
I want expect 3 output
- AAK-20250314-154055-Trik-4
- 02SAA-Trik-4
- 02SAA
Value = AAK-20250364-153865-Trik-10-03ADF
expect 3 output
- AAK-20250364-153865-Trik-10
- 03ADF-Trik-10
- 03ADF
Please guide me for solve it by use regex
Thankyou
Yoichi
(Yoichi)
2
Hi,
Can you try the following sample?
m =System.Text.RegularExpressions.Regex.Match(strData,"^([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)-([^-]+)$")
Then
m.Groups(1).Value+"-"+m.Groups(2).Value+"-"+m.Groups(3).Value+"-"+m.Groups(4).Value+"-"+m.Groups(5).Value
m.Groups(6).Value+"-"+m.Groups(4).Value+"-"+m.Groups(5).Value
m.Groups(6).Value
Sample
Sample20250324-2.zip (2.7 KB)
Regards,
2 Likes
pavitra
(Pavitra)
3
StringSplit.zip (156.1 KB)
The same can be achieved using string split() function as well.
Please find the code snippet.
1 Like
system
(system)
Closed
4
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.