find urls in string in Python duplicate
Question: Can someone help. As an example the following text output there more than pne
hyper link. I’m looking for the first output: **JournalEntries.dox?method=view
&number=JE-00000725**

    
    
    Here are my output source and i look for these ones **https://www.zuora.com/apps/JournalEntries.dox?method=view&number=JE-00000725**
    
        https://www.zuora.com/apps/JournalEntries.dox?method=view&number=JE-00000726
    https://www.zuora.com/apps/javascript:downloadTansactions("JournalEntries.dox?method=downloadTransactions&number=JE-00000726");
    https://www.zuora.com/apps/AccountingPeriods.dox?method=view&id=2c92a0f949efde7f0149f05314e640b6
    https://www.zuora.com/apps/ChartOfAccountsSetting.do?method=edit&id=2c92a0fb43812a1a0143980f213b7e34
    https://www.zuora.com/apps/ChartOfAccountsSetting.do?method=edit&id=2c92a0fb43812a1a0143980f21507e39
    https://www.zuora.com/apps/JournalEntries.dox?method=view&number=JE-00000725
    https://www.zuora.com/apps/javascript:downloadTansactions("JournalEntries.dox
    


Answer: I saved this in a file with name "url":

    
    
    https://www.zuora.com/apps/JournalEntries.dox?method=view&number=JE-00000725**
    https://www.zuora.com/apps/JournalEntries.dox?method=view&number=JE-00000726
    https://www.zuora.com/apps/javascript:downloadTansactions("JournalEntries.dox?method=downloadTransactions&number=JE-00000726");
    https://www.zuora.com/apps/AccountingPeriods.dox?method=view&id=2c92a0f949efde7f0149f05314e640b6
    https://www.zuora.com/apps/ChartOfAccountsSetting.do?method=edit&id=2c92a0fb43812a1a0143980f213b7e34
    https://www.zuora.com/apps/ChartOfAccountsSetting.do?method=edit&id=2c92a0fb43812a1a0143980f21507e39
    https://www.zuora.com/apps/JournalEntries.dox?method=view&number=JE-00000725
    https://www.zuora.com/apps/javascript:downloadTansactions("JournalEntries.dox
    

Now my code looks like:

    
    
    import re
    f = open ("url", "r").readlines()
    for i in f:
        if re.search("JournalEntries\.dox\?method\=view\&number\=JE\-00000725",i): 
            print "found it !!"
    

