Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Why this simple regex freeze my computer?

by mrpeabody (Friar)
on Dec 17, 2007 at 05:09 UTC ( [id://657369]=note: print w/replies, xml ) Need Help??


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;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://657369]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (4)
As of 2024-04-16 20:46 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found