Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to extract the uris lists by regex?
    primarykey
    data
    text
    <p>In my python code , I get strings from the text file like :</p> <pre><code>a = "[{'index': '1', 'selected': 'true', 'length': '0', 'completedLength': '0', 'path': '', 'uris': [{'status': 'used', 'uri': 'http://www.single.com'}]}]" b ="[{'index': '1', 'selected': 'true', 'length': '0', 'completedLength': '0', 'path': '', 'uris': [{'status': 'used', 'uri': 'http://www.mirrors.com'}, {'status': 'used', 'uri': 'http://www.mirrors2.com'}]}]" c ="[{'index': '1', 'selected': 'true', 'length': '103674793', 'completedLength': '0', 'path': '/home/dr/Maher_Al-Muaiqly_(MP3_Quran)/002.mp3', 'uris': []}, {'index': '2', 'selected': 'true', 'length': '62043128', 'completedLength': '0', 'path': '/home/dr/Maher_Al-Muaiqly_(MP3_Quran)/004.mp3', 'uris': []}, {'index': '3', 'selected': 'true', 'length': '57914945', 'completedLength': '0', 'path': '/home/dr/Maher_Al-Muaiqly_(MP3_Quran)/003.mp3', 'uris': []}]" </code></pre> <p>I want to get the text of the value uris , the output should looks like :</p> <pre><code>a = [{'status': 'used', 'uri': 'http://www.single.com'}] b = [{'status': 'used', 'uri': 'http://www.mirrors.com'}, {'status': 'used', 'uri': 'http://www.mirrors2.com'}] c = [[],[],[]] </code></pre> <p>Many hours I spent in failed trials to get this result by using the string functions ,</p> <pre><code>uris = str.split('}, {') for uri in uris : uri = uri.split(',') # and so on ... </code></pre> <p>but , it work so bad especially in the second case , I hope that anyone can do it by regex or any other way.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload