dravon
05-17-2006, 09:19 PM
Referring to the code borrowed from glenngv in the thread at http://www.codingforums.com/showthread.php?t=68639 which is quoted below, I'm having a problem with the second line shown in red.
For Each item In folder.Files
If regex.Test(item.path) Then
url = MapURL(item.path)
Response.Write("<li><a href=""" & url & """>" _
& item.Name & "</a> - " _
& item.Size & " bytes, " _
& "last modified on " & item.DateLastModified & "." _
& "</li>" & vbCrLf)
End If
Next
Using it as is, I get the following error: Expected ')' in regular expression. Based on this, my limited coding knowledge leads me to add a new ) as directed to get the new line of If regex.Test(item.path)) Then Results now say Expected 'Then'. Hrm... there is a "then" there... So I add another one as directed by the error code so now it looks like If regex.Test(item.path)) Then Then with the same results of Expected 'Then'. I tried removing all the parantheses on this line for the same results of Expected 'Then'. Pretty much from here on, whatever I tried (remove this, add that) I get the same Expected 'Then' results. At this point, now I'm going round in circles.
Is the .Test reference here supposed to be replaced with something specific to my code (like 'pathname' would be replaced)? It seems as if the code recognizes the If part of the statement but perhaps nothing is being properly set up so that it can't recognize the Then part of the statement. Any suggestions on how to look at this?
For Each item In folder.Files
If regex.Test(item.path) Then
url = MapURL(item.path)
Response.Write("<li><a href=""" & url & """>" _
& item.Name & "</a> - " _
& item.Size & " bytes, " _
& "last modified on " & item.DateLastModified & "." _
& "</li>" & vbCrLf)
End If
Next
Using it as is, I get the following error: Expected ')' in regular expression. Based on this, my limited coding knowledge leads me to add a new ) as directed to get the new line of If regex.Test(item.path)) Then Results now say Expected 'Then'. Hrm... there is a "then" there... So I add another one as directed by the error code so now it looks like If regex.Test(item.path)) Then Then with the same results of Expected 'Then'. I tried removing all the parantheses on this line for the same results of Expected 'Then'. Pretty much from here on, whatever I tried (remove this, add that) I get the same Expected 'Then' results. At this point, now I'm going round in circles.
Is the .Test reference here supposed to be replaced with something specific to my code (like 'pathname' would be replaced)? It seems as if the code recognizes the If part of the statement but perhaps nothing is being properly set up so that it can't recognize the Then part of the statement. Any suggestions on how to look at this?