1

I have a jumbly html form which are different order of attributes, such as:

<li><input type="text" name="tel" value="" id="tel" class="form1"></li>
<li><input type="text" value="" id="tel" class="form1"    name="tel" ></li>
<li><input type="text" name="tel" id="tel"  value=""  class="form1"></li>
<li>
    <select name="tel" id="tel" class="form1">
        <option></option>
    </select>
</li>
<li><input name="tel" id="tel" type="text" value=""  class="form1"></li>

SO I'm hope it be regular,the first attribute is type, and then are name, id, value, class etc., like this:

<input type="text" name="Common" id="" value="" class="">

Now I'm trying to come up with a solution:to catch the name attribute etc.

Pattern delimited by

(<input)(.*)(\bname\s*=['"](.*?)['"])

Replacement

$1 $3$2

But it's result was just match name attributes, how can it capture other attributes and sort this well organized?

<li><input name="tel" type="text"  value="" id="tel" class="form1"></li>
<li><input name="tel" type="text" value="" id="tel" class="form1"     ></li>
<li><input name="tel" type="text"  id="tel"  value=""  class="form1"></li>
<li>
    <select name="tel" id="tel" class="form1">
        <option></option>
    </select>
</li>
<li><input name="tel"  id="tel" type="text" value=""  class="form1"></li>
kkasp
  • 113
  • 1
  • 9

0 Answers0