title: use python re lib parsing "user define xpath" scripts
body: <p>I'm building a &quot;xpath parsing tool&quot; in Python for my team.
  In my case, the xpath script is not the normal xpath, the syntax that user input will be in a special struct, here is an example:</p>
  <p><strong>The input format will be like:</strong> (the element can be tuple-type or normal element)</p>
  <pre><code>sig = &quot;(xpath_1_1, xpath_1_2), (xpath_2_1, xpath_2_2), xpath_3...&quot;
  </code></pre>
  <p>which is edited in excel by users</p>
  <p><strong>And my goal is to parse the string into a list-type data with tuple or normal element:</strong></p>
  <pre><code>[(xpath_1_1, xpath_1_2), (xpath_2_1, xpath_2_2), xpath_3...]
  </code></pre>
  <p>Then I can input this data into my selenium to snapshot img sequentially.</p>
  <p><strong>Here is one of my testing data:</strong></p>
  <pre><code>sig = &quot;(//div[@style='font-family:Arial;float: left;width:930px;font-size:12px;' and ./span[contains(text(),'005930')]], //table[@id='gv_flow_krKS0 1']),//table[@id='123456'],(//div[@style='font-family:Arial;float: left;width:930px;font-size:12px;' and ./span[contains(text(),'000660')]],  //table[@id='gv_flow_krKS0 2']),//table[@id='456789']&quot;
  </code></pre>
  <p>I'm wondering is there any better way to implement this func without disrupting the order of list ?</p>
  <p>First , I think eval() func is not a good idea since it may cause some security prob.</p>
  <p>Now I'm trying to use re lib to solve it.</p>
  <p>However I found it's quite difficult and have no idea how to start.</p>
  <p>Anyone can help ? Thanks~</p>