Regular Expression for web_reg_save_param_regexp

16 views
Skip to first unread message

Rishu Sarpal

unread,
Sep 11, 2014, 9:27:57 AM9/11/14
to lr-loa...@googlegroups.com
Hello All,
 
I am dealing with a webpage where a table is returned with a rows of username, and their request status ("New Approval", "Approval in Process" etc). Along with this each row has a button which is
 
<input type="button" style="font-size:0.875em;" id="id37" value="View info"/>
 
Now I need to capture the id from this for ONLY those rows that have username starting with "ptapproval" AND  their request status is "New Approval".
 
Here's how the HTML looks like:
 
   <div title="ptapproval 002">ptapproval 002</div>
  </td><td>
   <div title="PerformanceTestLegalCompany002_BP">PerformanceTestLegalC...</div>
  </td><td>
   <div>Matta Ais (09-09-2014 16:35)</div>
  </td><td>
   <div>Syncro Transportation LSP</div>
  </td><td>
   <div>New Approval</div>
  </td><td>
   <div>
   <input type="button" style="font-size:0.875em;" id="id3e" value="View info"/>
</div>
  </td>
 </tr><tr>
  <td>
   <div title="User created by MRP test">User created by MRP test</div>
  </td><td>
   <div title="BP created by supplier NRP">BP created by supplie...</div>
  </td><td>
   <div>Podi Jayn (09-09-2014 15:16)</div>
  </td><td>
   <div>Syncro Supplier</div>
  </td><td>
   <div>New Approval</div>
  </td><td>
   <div>
   <input type="button" style="font-size:0.875em;" id="id3f" value="View info"/>
</div>
  </td>
 </tr><tr>
  <td>
   <div title="GerTest UAT test">GerTest UAT test</div>
  </td><td>
   <div title="20:20 Mobile (DK) A/S_BL">20:20 Mobile (DK) A/S_BL</div>
  </td><td>
   <div>Mtta As (09-09-2014 14:31)</div>
  </td><td>
   <div>Product Data Master</div>
  </td><td>
   <div>Removal In Progress</div>
  </td><td>
   <div>
   <input type="button" style="font-size:0.875em;" id="id40" value="View info"/>
</div>
  </td>
 </tr>
 
I have build a Regular Expression for this :
 
\s+<div title=\"ptapproval[^,]+<div>New Approval[^,]+ <input type=\"button\" [^,].+ id=\"([^ ].+)\"\s+value=\"View info\"
 
But problem is, its not stopping after first match and is instead matching the entire above html until the last match of  "<input type="button" style="font-size:0.875em;" id="id40" value="View info"/>" and hence picking id value as id40 instead of "id3e" (from first match)
 
Could anyone advise on how can make the Regular Expression to stop on the first match?
-Rishu Sarpal
Reply all
Reply to author
Forward
0 new messages