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

Please support RegExLib Sponsors

Sponsors

Expressions by User

   Displaying page 1 of 1 pages; Items 1 to 3
Title Test Details 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
Title Test Details Pattern Title
Expression
<select(.|\n)*?selected(.|\n)*?>(.*?)</option>(.|\n)*?</select>
Description
All useful examples are multi-line, so not displayed. this will match any <select></select> block in an HTML document, and the return $3 will contain the displayed text (NOT the value of the displayed option)
Matches
<select><option selected>returned text</option></select>
Non-Matches
<select><option>returned text</option></select>
Author Rating: Not yet rated. Richard Hensman
Title Test Details Pattern Title
Expression
<textarea(.|\n)*?>((.|\n)*?)</textarea>
Description
Matches any textarea block, and returns the text inside it.
Matches
<textarea>return</textarea>
Non-Matches
<textarea>returned </improperTextareaEndTag>
Author Rating: Not yet rated. Richard Hensman
   Displaying page 1 of 1 pages; Items 1 to 3

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