I am pulling bus routes from a database by bus number and then pulling the stop times from each run. I then pull the first and last times from those arrays.
This works fine, and will display the full routes:
<%
Routes = Array(Rs("Route1"), Rs("Route2"), Rs("Route3"))
For Each Route in Routes
%>
<%=Route%><br />
<%
Next
%>
This also works fine, and will deliver the first and last time from one route:
Route = Rs("Route2")
Times = Trim(RegExpTest("(\s|(\s\d))\d:\d\d\s", Route))
Function RegExpTest(patrn, strng)
Dim regEx, Match, Matches, RetStr
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(strng)
For Each Match in Matches
RetStr = RetStr & " " & Trim(Match.Value) & " "
Next
RegExpTest = RetStr
End Function
First = Trim(Left(Times,5))
Last = Trim(Right(Times,5))
%>
<%=First%>
<%=Last%>
But combining the two fails. I haven't figured out why. Error message is
a vbscript syntax error.
Routes = Array(Rs("Route1"), Rs("Route2"), Rs("Route3"))
For Each Route in Routes
Times = Trim(RegExpTest("(\s|(\s\d))\d:\d\d\s", Route.Value))
Function RegExpTest(patrn, strng)
Dim regEx, Match, Matches, RetStr
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
Set Matches = regEx.Execute(strng)
For Each Match in Matches
RetStr = RetStr & " " & Trim(Match.Value) & " "
Next
RegExpTest = RetStr
End Function
First = Trim(Left(Times,5))
Last = Trim(Right(Times,5))
%>
<%=First%>
<%=Last%>
<% Next %>
Any help would be deeply appreciated.
Lee