Reputation: 231
I'm trying to find a form in HTML using Regex in Visual Basic .NET, though, there are different forms, and I want the one with certain attributes on it.
I want to find this one:
<form method="post"
While there are others looking like this:
<form method="get"
I already have the code for this, but my code cannot recognize where the first form ends and the next one starts, so I get this whole HTML script where the first form starts
<form>
And the last form ends
</form>
To understand better what I mean, check this out: http://rubular.com/r/HDU0yVFtIk
Upvotes: 1
Views: 68
Reputation: 29419
You need to make your last *
match non-greedy by appending a ?
as in:
<form.*>[^*]*?<\/form>
per http://rubular.com/r/6cYBTxX85F
Upvotes: 1
Reputation: 3067
Are you trying to find the form with the post method?
If so, you're almost there.
<form method="post".*>[^*]*<\/form>
http://rubular.com/r/DAi75yjQqU
Upvotes: 2