What should be the expression of output for regex?
Input: ssters1.1December1995.txts32
Ouput: 1December1995
What should be the expression of output for regex?
Input: ssters1.1December1995.txts32
Ouput: 1December1995
Hi @Ruchita_Patil ,
The regex expression is: \d{1,}\w.*\d{4}
Have a nice day!
Thanks & Regards,
Shubham Dutta
Hi,
What if there are multiple entries and I want a generic expression?
string1.20march95.text2
str1.27June1998.txt3
ssters1.1December1995.txts32
Hi @Ruchita_Patil ,
do you want only regex or string manipulation will work?
Because for your use case string manipulation will be easy approach.
yes, that would help too
Hi @Ruchita_Patil ,
then use this: str_input.split("."c)(1)
Thanks & Regards,
Shubham Dutta
Hi @Ruchita_Patil ,
I am also attaching the code for your reference, I think that will help you more.
String_manipulation.xaml (7.0 KB)
Thanks & Regards,
Shubham Dutta
HI,
FYI, another approach:
If you want to extract dMMMMyyyy or dMMMMyy style date string, the following will work.
System.Text.RegularExpressions.Regex.Match(yourString,"\d{1,2}(January|February|March|April|May|June|July|August|September|October|November|December)\d{2,4}",System.Text.RegularExpressions.RegexOptions.IgnoreCase).Value
Regards,
How about this expression?
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=\.).*?(?=\.)").Tostring
Regards
Gokul
@Ruchita_Patil
You can use 2 methods
System.Text.RegularExpressions.Regex.Match(YourString,"(?<=\.).*(?=\.)").Tostring.Trim
2. Use string Manipulation
Split(" ssters1.1December1995.txts32",".")(1).ToString.Trim