jsapkota
(JSapkota)
1
I have following strings in a column -
GD45637 24/03/2020
GD #34567 (03-03-2020)
I want to get the numeric part of the string -
45637
34567
I tried to use split with a " " but that doesn’t work for the second string.
Could anyone help me acheive this requirement?
Yoichi
(Yoichi)
2
Hi,
If there is no other 5 digit number, the following expression will work.
System.Text.RegularExpressions.Regex.Match(yourString,"(?<=\D)\d{5}(?=\D)").Value
Regards,
jsapkota
(JSapkota)
3
Hi Yoichi, Thanks for your reply. The problem is the length of the numeric portion of the string is also variable. Only Constant is the initial ‘GD’
Yoichi
(Yoichi)
4
Hi,
Only Constant is the initial ‘GD’
How about the following?
System.Text.RegularExpressions.Regex.Match(yourString,"(?<=GD\W*)\d+(?=\s)").Value
Regards,
1 Like
jsapkota
(JSapkota)
5
Amazing!!! it works!!! I have tested with 5-7 variants. Thank you so much!! Stay Safe!
1 Like
system
(system)
Closed
6
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.