anjasing
(Anjali)
June 2, 2022, 11:24am
1
outputFinal =
System.Text.RegularExpressions.Regex.Match(extractDTString.ToString,“(. ?)-. ?(”+ todDate +“). ?-. ?([A-Z]+).*?(”+ ExecutionHour +“)”).ToString
where
todDate = DateTime.Now.tostring(“yyyyMMdd”)
ExecutionHour =Cint(DateTime.Now.tostring(“hh”))
but it’s giving issue:
jack.chan
(Jack Chan)
June 2, 2022, 11:28am
3
@anjasing
add .toString after ExecutionHour
like this
System.Text.RegularExpressions.Regex.Match(extractDTString.ToString,"(. ?)-. ?("+ todDate +"). ?-. ?([A-Z]+).*?("+ ExecutionHour.ToString +")").ToString
ppr
(Peter Preuss)
June 2, 2022, 11:43am
4
String.Format("(.*?)-.*?({0}).*?-.*?([A-Z]+).*?({1})", Now.tostring("yyyyMMdd"),DateTime.Now.toString("HH"))
anjasing
(Anjali)
June 2, 2022, 1:14pm
5
HI,
outputFinal = System.Text.RegularExpressions.Regex.Match(extractDTString.ToString,String.Format(“(.?)-. ?({0}).?-. ?([A-Z]+).*?({1})”, Now.tostring(“yyyyMMdd”),DateTime.Now.toString(“HH”))).ToString
Isn’t it correct?
ppr
(Peter Preuss)
June 2, 2022, 1:17pm
6
can you test it within your immdediate panel?
Understanding the 6 Debugging Panels of UiPath in the easiest way possible! - News / Tutorials - UiPath Community Forum
the pattern itself you also can test e.g. https://regex101.com/
we would suggest to use a variable for the pattern e.g. strpattern and use it within the regex.match method. This makes the implementation more easy to read and trace