javascript正则表达式替换除某些标记之外的html属性

时间:2016-05-16 01:25:29

标签: javascript html regex

我想使用正则表达式替换html属性ng-model='model.xxx' to ng-model='model.newname.xxx',但我不需要<tbody> <tr class='template' ng-repeat='model in model.child'></tr></tbody>之间的替换属性;

<table width="592" height="842" border="1" align="center">
      <tr>
        <td align="center" colspan="2" width="16%">serve_resource_name</td>
        <td colspan="8"><input class="text" name="serve_resource_name" type="text" ng-model="model.serve_resource_name" id="serve_resource_name" title="serve_resource_name" value="" maxlength="" plugins="text" fallowblank="false" datatype="text"/></td>
      </tr>
      <tr>
        <td align="center" rowspan="4" width="8%">clinet</td>
        <td align="center" style="width:8%">system</td>
        <td colspan="3"><input class="text" name="system" type="text" ng-model="model.system" id="system" title="系统" value="" maxlength="" plugins="text" fallowblank="false" datatype="text"/></td>
        <td align="center" colspan="2" width="16%">IP</td>
        <td colspan="3"><input class="text" name="ip" type="text" ng-model="model.ip" id="ip" title="IP" value="" maxlength="" plugins="text" fallowblank="false" datatype="text"/></td>
      </tr>
      <tr>
        <td align="center">username</td>
        <td colspan="3"><input class="text" name="username" type="text" ng-model="model.username" id="username" title="用户名" value="" maxlength="" plugins="text" fallowblank="false" datatype="text"/></td>
        <td align="center" colspan="2" width="16%">password</td>
        <td colspan="3"><input class="text" name="password" type="text" ng-model="model.password" id="password" title="密码" value="" maxlength="" plugins="text" fallowblank="false" datatype="text"/></td>
      </tr>
      <tr>
        <td align="center" width="16%">time_limit</td>
        <td colspan="8"><input class="text" name="time_limit" type="text" ng-model="model.time_limit" id="time_limit" title="期限" value="" maxlength="" plugins="text" fallowblank="false" datatype="text"/></td>
      </tr>``

       <tr>
            <td align="center" width="8%" height="150px">flow control</td>
            <td colspan="9" style="padding:0; vertical-align:top;">
            <div style="overflow:auto; height:150px;">
                <table id="697e5afad8e540659efb412ea0347b5d" name="flowControl" fnote="flow control" fdatatype="1" plugins="childtable" border="1" cellspacing="0" cellpadding="0">
                    <thead>
                        <tr class="firstRow">
                            <td align="center" width="24%">time_quantum</td>
                            <td align="center" width="24%">interval</td>
                            <td align="center" width="24%">time_interval_min</td>
                            <td align="center" width="24%">visit_count_limit</td>
                            <td align="center"  ><div class="img-add" ng-click="imgAdd('model.table')"></div></td>
                      </tr>
                    </thead>
                    <tbody>
                        <tr class="template" ng-repeat="model in model.child">
                            <td ><input name="time_start" type="text" ng-model="model.time_start" id="time_start" title="time_start" value="" maxlength="" placeholder="8:00"/>-<input name="time_end" type="text" ng-model="model.time_end" id="time_end" title="time_end" value=""placeholder="22:00"/></td>
                            <td ><input name="time_interval_count" type="text" ng-model="model.time_interval_count" id="time_interval_count" title="time_interval_count" value="" /></td>
                            <td ><input class="text" name="visit_count_limit" type="text" ng-model="model.visit_count_limit" id="visit_count_limit" title="visit_count_limit" value="" "/></td>
                            <td ><input class="text" name="visit_flux_limit" type="text" ng-model="model.visit_flux_limit" id="visit_flux_limit" title="visit_flux_limit" value="" /></td>
                        </tr>
                    </tbody>

                </table></div>
            </td>
        </tr>
      <tr>
        <td align="center" width="8%">remark</td>
        <td colspan="9">
         <div class="word-text"><textarea class="bor" id="remark" name="remark" ng-model="model.remark" title="remark" maxlength="" plugins="textarea" fallowblank="false"></textarea></div>
        </td>
      </tr>
      </table>`

0 个答案:

没有答案