Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Simple re question

by diotalevi (Canon)
on Jan 27, 2003 at 21:17 UTC ( [id://230357]=note: print w/replies, xml ) Need Help??


in reply to Re: Simple re question
in thread Simple re question

It's not such a big deal. You're forcing the regex engine to make an extra copy of your data which in this case is a few measly bytes. It can make a difference for other scripts but you shouldn't even worry about it here. You'd need an advanced degree in Regex-ology to know exactly why though. I'd have to refer back to my copy of Mastering Regular Expressions to get the exact semantics.

The general idea though is that those special variables must still be valid even if you alter or mangle the original string. The only way that works is if perl makes a new copy just for them. So that's the overhead. In this case it just doesn't matter.

If your data is normal enough then you can use something like this $title =~ m{(<=- )([^"]+)}; on it. The return value (true/false) indicates whether it matched or not and the title is stored in $1.


Seeking Green geeks in Minnesota

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2024-04-26 01:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found