regex - how to create regular expression in php for all input tags in a webpage? -
plz me in making regular expressions explaination of each components.i want parse input tags , text areatags given below-
<input id="t_15_k_5" type="text" value="xxychf" name="t_15_k_5" style="display: none;"></input> <input type="hidden" value="sn2sms" name="i_m" style="display: none;"></input> <input id="kriya" type="hidden" value="sa65sdf656fdfd" name="kriya"></input> <textarea id="m_15_b" name="m_15_b" style="display: none;">mwlcqrzp</textarea>
also 1 -
<input id="mwlcqrzp" class="wickenabled input" type="text" onblur="if(this.value=='') this.value='mobile number';" onfocus="if(this.value=='mobile number') this.value='';" value="mobile number" onchange="javascript:displocmob(this);" onkeydown="javascript:displocmob(this);" onkeyup="javascript:displocmob(this);" maxlength="10" name="mwlcqrzp"></input>
i have written code not working-
preg_match_all("~<textarea(?=[^>]* name=[\"']([^'\"]*)|)(\s+[^>]*)?>(.*?)</textarea>~",$content,$textarearesults) preg_match_all('/<input(?=[^>]* name=["\']([^\'"]*)|)(?=[^>]* value=["\']([^\'"]*)|)/',$content,$results);
plz help.
use parser
http://simplehtmldom.sourceforge.net/
for example
if have use regex, regex each is
the actual regex each
<input\b[^>]*>(.*?)</input>
<textarea\b[^>]*>(.*?)</textarea>
note: regex above not match nested tags, in case isnt issue
Comments
Post a Comment