<%
Function Reggex(strString, strPattern, strReplace)
Dim RE: Set RE = New RegExp
With RE
.Pattern = strPattern
.Global = True
.IgnoreCase = True
Reggex = .Replace(strString, strReplace)
End With
End Function
Function ReplaceChar(strString)
fromDate="1-Jan-2000"
toDate=date
strString = Reggex(strString, "\[BusDate\]", ""&DateDiff("yyyy",fromDate,toDate)&"")
'This will give the output of 16 (being that it is 2016 now)
'However, what I need is to be able to type in the 2 dates.
strString = Reggex(strString, "\[theDate:([^\]]+)\|(.*?)\]", ""&DateDiff("yyyy","$1","$2")&"")
'However, the output in this example, will give me 1 (ONE)
ReplaceChar = strString
End Function
working = "[Busdate]"
testing = "[theDate:1950|2016]"
%>
Working: <%=ReplaceChar(working)%><br />
Non-working: <%=ReplaceChar(testing)%>
Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.
”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.
Our community of experts have been thoroughly vetted for their expertise and industry experience.
The Distinguished Expert awards are presented to the top veteran and rookie experts to earn the most points in the top 50 topics.