Hi, Monks.

I can't realize why this regex freeze my computer. Here is code:

#!/usr/bin/perl use strict; use warnings; my $bid_str = <<END; <td class='list_cell'> <a name='15'></a> <span style="font-size: 120%;">Dec 15.07</span><br> <span style="font-size: 120%;">[--:--]</span> </td> <td class='list_cell'> <span style="font-size: 120%;" target='_top'>9998</span><b +r> Okayama </td> <td class='list_cell' style="font-size: 110%;">1988</td> <td class='list_cell' align="left"> <a href='e_shitami.asp?kaijo=OK&ss=9000&se=9999&m=&s=SyupN +o&o=ASC&ap=15&pgcd=E-113&lst=E-111&p=1&listpos=15&tkaijo=OK&taa=561&t +syup=9998' target='_top'> </a><br> </td> <td class='list_cell' style="font-size: 120%;"> FA<br> </td> <td class='list_cell' align="right" style="font-size: 120%;"> 0 <br> </td> <td class='list_cell'>white<br></td> <td class='list_cell' align="left"> &nbsp;&nbsp; <br> AC </td> <td class='list_cell' align='left'>&nbsp;<img src='../../image +s/clear.gif' width='12' height='12' style='display:inline'>&nbsp;non +Auction</td> <td class='list_cell' align='right'> ----<br> 88,888 </td> <td class='list_cell' valign='middle' style="font-size:120%;"> +</td> END my ( $date_shedule, $bid_num_site, $year_raw, $model_grade, $transmiss +ion_displacement, $mileage_inspection, $color_raw, $type_equipment, $ +result_raw, $final_start, $scores_raw ) = $bid_str =~ 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;

If i change regex to (i show only last part)(i replace + with *) :

...<td[^>]*>\s*(.*?)\s*</td>\s*}is;

it works fine. I think it must simple return no match but it freeze!


In reply to Why this simple regex freeze my computer? by Gangabass

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.