So I guess this is why everybody advises against matching HTML with regexs ;-) Unfortunately, with my app, I don't have a choice to read it from the DOM... I have an IE add-on reading HTML and passing it on to me to parse it server-side, and I'm seeing some things I've never seen. For some reason IE is at times returning values and names without double quotes around them.
<INPUT onchange=setdirty(0); value=555-555-1212 type=text name=phn_Agent_Phone_CF15>
<INPUT onchange=setdirty(0); value=test@test.com type=text name=email_Agent_Email_CF15>
<INPUT onchange=setdirty(0); value=1/1/2010 type=text name=dt_HFTrip_from_date_CF15>
I don't need one gigantic regex that can capture all values - need one that I can define the name in, and get the value. But the trick is, sometimes the name has quotes around it, sometimes it doesn't (I made this optional for the name, see below). But the value of the tag is really throwing me off. I can't seem to define in my capture a way to tell it that if it has no double quotes around the value, to go ahead and allow it, but stop capturing after the first space it encounters.
One regular expression, that can capture the value of of an HTML INPUT tag based on the name I define it, with double quotes being totally optional, would be awesome, but not necessary... I have a regular expression that works great when there are quotes around it, but I can't seem to get the one to work that has no double quotes around the value.
Here's what I'm trying for the email address, *when it has double quotes* (it works great):
<input [^>]*(?<=name="?email_Agent_Email_CF15"?[^<]*)(?<=value="([^"]*)"[^<]*)>
But no matter what I try for accommodating for ones with no quotes, just stopping at the first space, I always end up getting extra markup that shouldn't be returned.
Your help is GREATLY appreciated - thanks!
<input [^>]*(?<=name="?email_Agen