|
-
Aug 26th, 2009, 03:54 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] for loop through results
Hi Guys,
I can't think of a better way to do this, what i have is this function:
vb.net Code:
Function functionDealWithHiddenFields(ByVal HTML As String, ByVal numHiddenFields As Integer)
Try
'// The html source
Dim sText = HTML
'// The string we are searching for
Dim sPattern As String = "(?<=<input type=""hidden"" class="").*?(?="".*?')"
'// This is the regular expression
Dim regex As New Regex(sPattern, RegexOptions.IgnoreCase Or RegexOptions.Singleline)
'// The matches that we return are put in the matchcollection
Dim regexMatches As MatchCollection = regex.Matches(sText)
'// Return
'Return regexMatches(0).ToString
For x As Integer = 0 To numHiddenFields
MessageBox.Show(regexMatches(x).ToString)
Next
Catch ex As Exception
'Return False
Return False
End Try
End Function
I feed in afew parameters, one being
PHP Code:
numHiddenFields
which usually contains: 4 so when i loop out the names, it loops the 4 results, 4 times, instead of just showing me the names 4 times so i can then store them
i'm probably doing something basic lol
any help would be great
thanks guys
Graham
-
Aug 26th, 2009, 03:59 AM
#2
Thread Starter
Hyperactive Member
Re: for loop through results
Sory guys, i'm an idiot, im feeding a for loop into a for loop.
cheers
Graham
-
Aug 26th, 2009, 04:02 AM
#3
Re: [RESOLVED] for loop through results
vb.net Code:
For Each reMatch As Match In regexMatches MessageBox.Show(reMatch.Value) Next
Last edited by Pradeep1210; Aug 26th, 2009 at 04:05 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|