Help Me to get spesific value from string

Hi I have an example of sting
EIde hudwidw-ja278235-201 20230619 Sadhuowaud128312

The pattern is i want to get the value of 20230619 , its always numbers and always in a date format

Thanks

Hi,

How about the following expression?

System.Text.RegularExpressions.Regex.Match(yourString,"\b\d{8}\b").Value

Regards,

Hi

System.Text.RegularExpressions.Regex.Match(YourString,“\d{8}(?=\s[A-Z]*[a-z]+\d+)”).Value

I hope this will help you

Thank you

1 Like

HI Yoichi thanks this works for me,

if u dont mind me adding a question,
from this output i will get 20230619

then i realized i actually need to have it in this format 19062023

is there any solution for this?

thanks btw

Hi,

Can you try as the following?

m = System.Text.RegularExpressions.Regex.Match(yourString,"\b(\d{4})(\d{2})(\d{2})\b")

Then

m.Groups(3).Value+m.Groups(2).Value+m.Groups(1).Value

Sample20230707-2.zip (2.6 KB)

Regards,

2 Likes

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