Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

regexp question

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


jabba.laci at gmail

Nov 6, 2009, 1:50 PM

Post #1 of 1 (37 views)
Permalink
regexp question

Hi,

How to find all occurences of a substring in a string? I want to
convert the following Perl code to Python.

Thanks,

Laszlo

==========

my $text = '<a href="ad1">sdqs</a><a href="ad2">sds</a><a href=ad3>qs</a>';

while ($text =~ m#href="?(.*?)"?>#g)
{
print $1, "\n";
}
# output:
#
# ad1
# ad2
# ad3
--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.