Optional Last Group

I recently obtained the following Regex from you guys:

Regex inputTagExtractor = new Regex(@"<input\b[^>]*(name|type|value)=""?(.*?)[""|\s].*?(name|type|value)=""?(.*?)[""|\s].*?(name|type|value)=""?(.*?)[""|\s].*?[/>|>]",              RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline);

Which works great but it is failing to properly capture a pair of hidden fields.  I am trying to match the following:

<input type="hidden" name="hidText" id="hidText" value="/hidId" />
</div>
 <div>
 <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWCALT/7PYBwLxtoDlBwL34Jz7BwLJvZ+rDALxkoH3AQKTqKrwBAKT54ruAgKx0LOhDQ==" />
</div>

There should be two matches here but, for some reason, there is only one match that extends across both input fields...
 
ktolaAsked:
Who is Participating?
 
käµfm³d 👽Commented:
Is the following correct?
Regex inputTagExtractor = new Regex(@"<input\b[^>]*?(name|type|value)=""?(.*?)[""|\s].*?(name|type|value)=""?(.*?)[""|\s].*?(name|type|value)=""?(.*?)[""|\s].*?/?>", RegexOptions.IgnoreCase | RegexOptions.Compiled | RegexOptions.Singleline);

Open in new window

0
 
ktolaAuthor Commented:
That was it - thank you!
0
 
käµfm³d 👽Commented:
NP. Glad to help  :)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.