in reply to Why this simple regex freeze my computer?
m{<td[^>]*>\s*(.+?)\s*</td>\s*<td[^>]*>\s*(.+?)\s*</td>\s* <td[^>]*>\s*(.+?)\s*</td>\s*<td[^>]*>\s*(.+?)\s*</td>\s* <td[^>]*>\s*(.+?)\s*</td>\s*<td[^>]*>\s*(.+?)\s*</td>\s* <td[^>]*>\s*(.+?)\s*</td>\s*<td[^>]*>\s*(.+?)\s*</td>\s* <td[^>]*>\s*(.+?)\s*</td>\s*<td[^>]*>\s*(.+?)\s*</td>\s* <td[^>]*>\s*(.+?)\s*</td>\s*}is;
is not my idea of a simple regex.
It could also be written more clearly as (untested):
my $text = "..."; my $cell = qr{ <td[^>]*> \s* (.+?) \s* </td> \s* }isx; my @result = $text =~ m/ $cell $cell $cell $cell $cell $cell $cell $cell $cell $cell $cell /x;
|
|---|