Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Help on using alternation grouping star versus dot star.

by Abigail (Deacon)
on Jun 10, 2001 at 17:17 UTC ( [id://87287]=note: print w/replies, xml ) Need Help??


in reply to Help on using alternation grouping star versus dot star.

In Friedls book Mastering Regular Expressions this technique is called loop unrolling. Your second example is bad because of the nested * - Perl should warn you about them. I would write it as:
m{<div\s+class\s*=\s*"blockqte"\s*>((?:[^<]+|</?s)*)</div>}

-- Abigail

Replies are listed 'Best First'.
Re: Re: Help on using alternation grouping star versus dot star.
by Anonymous Monk on Jun 15, 2001 at 09:45 UTC
    Hi Abigail. Thank you for the advise. Could you please explain to this neophyte why changing the nested * to a nested + makes so much of a difference. Mark.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 17:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found