Hi All,
Please help in extracting date from the below string:
03-May-2017 05:43Hi All,
Please help in extracting date from the below string:
03-May-2017 05:43@som17 If the date is always in the same format, then you can try this :
System.Text.RegularExpressions.Regex.Matches(“03-May-2017 05:43”,“\d\d-\w±\d{4}”)(0).ToString
the dats can vary…but the format of string will be the same
for fileName i am extracting it like this…
when filename in the HTML string is :3may17.zip
holdline.Substring(holdline.indexof(“href=”)+6,holdline.indexof(“”“>”,holdline.indexof(“href=”)+6)-(holdline.indexof(“href=”)+6))
Can it be dynamic for date as well?
@som17 Can you explain what are you trying to extract from the html ? , If you can provide the html String in a Text and tell us what needs to be extracted?
td align=“right”>21-May-2019 12:03 </td
no…it doesn’t
I assigned fileDate=holdline.Substring(holdline.indexof(“align=”)+2,holdline.indexof(“”“>”,holdline.indexof(“align=”)+2)-(holdline.indexof(“align=”)+2))
where holdLine is a string
but BOT is giving output as : ign="top
extracting top froom the string part:
td align=“right”>21-Aug-2019 15:09 td align=“right”>109KÂ
td valign=“top”>
i cant use that as it will hardcode the string…i have to keep it dynamic
can you please share the kind of expression u r suggesting?
@som17 Considering you have the td tag in the holdline variable, you can try this :
System.Text.RegularExpressions.Regex.Matches(holdline,“\d\d-\w±\d{4}”)(0).ToString
it gave error:
Assign: Specified argument was out of the range of valid values.
Parameter name: i
i used it like fileDate= System.Text.RegularExpressions.Regex.Matches(holdline,“\d\d-\w±\d{4}”)(0).ToString
You can extract text using substring as below
strText.Substring(strText.IndexOf(“>”)+1,strText.IndexOf(“</”)-strText.IndexOf(“>”)-1).Trim