RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Pattern Title
Expression
<input[^>]*?type[/s]*=[/s]*(['|"]?)text\1[^>]*?value[/s]*=[/s]*(['|"])(.*?)\2[^>]*?>
Description
<input[^>]*?value[/s]*=[/s]*(['|"])(.*?)\1[^>]*?type[/s]*=[/s]*(['|"]?)text\3[^>]*?> A pair of reg ex's to capture the value from an <input type=text> - depending on whether the type or value is listed first in the tag. For some reason, when I combine them as a []|[] form regex, they don't work at all any more. The font on this site doesn't show the difference, but the last matching expression has a " character, the last non-matching one has two ' characters. The last non-matching exp matches (with the typo in value fixed), but doesn't return the value correctly, any help with that would be appreciated. (this is my first commercially-used regex... I'm new to this still)
Matches
<input type=text value="qwerty"> | <input type="text" value='qwerty' &g
Non-Matches
<input type=text value=qwerty> | <input type=button value="ClickMe"> | <inp
Author Rating: Not yet rated. Richard Hensman
Source
Your Rating
Bad Good

Enter New Comment

Title
 
Name
 
Comment
 
Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Copyright © 2001-2018, RegexAdvice.com | ASP.NET Tutorials